Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,9 @@ import os
|
|
| 3 |
import gradio as gr
|
| 4 |
from transformers import pipeline
|
| 5 |
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
sd_description = "ζεηζεΎη"
|
| 8 |
sd_examples = [["ε°η«"], ["cat"], ["dog"]]
|
|
@@ -14,13 +17,16 @@ examples = [[os.path.join(os.path.dirname(__file__), "lion.jpg")], [os.path.join
|
|
| 14 |
app = gr.Interface.from_pipeline(pipe, examples=examples, title='εΎηθ―ε«')
|
| 15 |
|
| 16 |
|
| 17 |
-
from diffusers import StableDiffusionPipeline
|
| 18 |
-
import torch
|
| 19 |
-
|
| 20 |
model_id = "dreamlike-art/dreamlike-photoreal-2.0"
|
| 21 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
examples = [["θ½ζ₯"], ["ζ²ζ»©"]]
|
| 23 |
-
app_v1 = gr.Interface
|
| 24 |
|
| 25 |
|
| 26 |
demo = gr.TabbedInterface([sd_demo, app, app_v1], ["ζεηζεΎη", "εΎηθ―ε«", "ζεηζεΎηv1"])
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
from transformers import pipeline
|
| 5 |
|
| 6 |
+
from diffusers import StableDiffusionPipeline
|
| 7 |
+
import torch
|
| 8 |
+
|
| 9 |
|
| 10 |
sd_description = "ζεηζεΎη"
|
| 11 |
sd_examples = [["ε°η«"], ["cat"], ["dog"]]
|
|
|
|
| 17 |
app = gr.Interface.from_pipeline(pipe, examples=examples, title='εΎηθ―ε«')
|
| 18 |
|
| 19 |
|
|
|
|
|
|
|
|
|
|
| 20 |
model_id = "dreamlike-art/dreamlike-photoreal-2.0"
|
| 21 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
| 22 |
+
pipe_v1 = pipe.to("cpu")
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def generate_image_v1(prompt):
|
| 26 |
+
return pipe_v1(prompt).images[0]
|
| 27 |
+
|
| 28 |
examples = [["θ½ζ₯"], ["ζ²ζ»©"]]
|
| 29 |
+
app_v1 = gr.Interface(fn=generate_image_v1, inputs="text", outputs="image", examples=examples)
|
| 30 |
|
| 31 |
|
| 32 |
demo = gr.TabbedInterface([sd_demo, app, app_v1], ["ζεηζεΎη", "εΎηθ―ε«", "ζεηζεΎηv1"])
|