Daniton commited on
Commit
38d46be
·
1 Parent(s): 23a02ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -1,12 +1,14 @@
1
  import gradio as gr
2
  from diffusers import StableDiffusionPipeline
3
  import torch
 
4
 
5
  model_id = "prompthero/openjourney"
6
  pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
7
 
8
  def generate_image(prompt):
9
  image = pipe(prompt).images[0]
 
10
  return image
11
 
12
  iface = gr.Interface(generate_image, gr.inputs.Textbox(label="Enter a prompt"), gr.outputs.Image())
 
1
  import gradio as gr
2
  from diffusers import StableDiffusionPipeline
3
  import torch
4
+ from PIL import Image
5
 
6
  model_id = "prompthero/openjourney"
7
  pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
8
 
9
  def generate_image(prompt):
10
  image = pipe(prompt).images[0]
11
+ image = Image.fromarray(image.numpy())
12
  return image
13
 
14
  iface = gr.Interface(generate_image, gr.inputs.Textbox(label="Enter a prompt"), gr.outputs.Image())