Vijish commited on
Commit
5440b39
·
1 Parent(s): ceebb70

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -1
app.py CHANGED
@@ -1,3 +1,27 @@
1
  import gradio as gr
2
 
3
- gr.Interface.load("models/prompthero/openjourney").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ from diffusers import StableDiffusionPipeline
4
+ import torch
5
+
6
+ def dummy(images, **kwargs): return images, False
7
+
8
+
9
+ def generate_image(prompt):
10
+ model_id = "prompthero/openjourney-v4"
11
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
12
+ pipe.safety_checker = dummy
13
+ pipe = pipe.to("cuda")
14
+ image = pipe(prompt).images[0]
15
+ return image
16
+
17
+
18
+ iface = gr.Interface(
19
+ generate_image,
20
+ "textbox",
21
+ "image",
22
+ title="Image Generator",
23
+ description="Generate a realistic photo using prompts.",
24
+ examples=[["realistic! photoshoot for a new balenciaga lookbook, color film photography, portrait of a beautiful woman wearing a balaclava mask, photo in style of tyler mitchell, 35mm lens"]],
25
+ )
26
+
27
+ iface.launch()