lvyb commited on
Commit
9ebbfac
β€’
1 Parent(s): 893a6c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -3,8 +3,8 @@ import os
3
  import gradio as gr
4
  from transformers import pipeline
5
 
6
- from diffusers import StableDiffusionPipeline
7
- import torch
8
 
9
 
10
  sd_description = "ζ–‡ε­—η”Ÿζˆε›Ύη‰‡"
@@ -17,19 +17,19 @@ examples = [[os.path.join(os.path.dirname(__file__), "lion.jpg")], [os.path.join
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.float32)
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"])
33
 
34
 
35
  demo.launch()
 
3
  import gradio as gr
4
  from transformers import pipeline
5
 
6
+ # from diffusers import StableDiffusionPipeline
7
+ # import torch
8
 
9
 
10
  sd_description = "ζ–‡ε­—η”Ÿζˆε›Ύη‰‡"
 
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.float32)
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], ["ζ–‡ε­—η”Ÿζˆε›Ύη‰‡", "ε›Ύη‰‡θ―†εˆ«"])
33
 
34
 
35
  demo.launch()