tbdatasci commited on
Commit
25d5798
1 Parent(s): 149ef16
Files changed (1) hide show
  1. app.py +26 -21
app.py CHANGED
@@ -1,28 +1,33 @@
1
- import gradio as gr
2
- from diffusers import DiffusionPipeline
 
 
 
 
3
 
4
- # get_completion = pipeline("image-to-text",model="nlpconnect/vit-gpt2-image-captioning")
 
 
5
 
6
- pipeline = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")
 
 
7
 
8
- # def summarize(input):
9
- # output = get_completion(input)
10
- # return output[0]['generated_text']
11
 
12
- # def captioner(image):
13
- # result = get_completion(image)
14
- # return result[0]['generated_text']
 
 
 
 
 
15
 
16
- def generate(prompt):
17
- return pipeline(prompt).images[0]
18
 
19
- gr.close_all()
20
- demo = gr.Interface(fn=generate,
21
- inputs=[gr.Textbox(label="Your prompt")],
22
- outputs=[gr.Image(label="Result")],
23
- title="Image Generation with Stable Diffusion",
24
- description="Generate any image with Stable Diffusion",
25
- allow_flagging="never",
26
- examples=["the spirit of a tamagotchi wandering in the city of Vienna","a mecha robot in a favela"])
27
 
28
- demo.launch()
 
 
 
1
+ # import gradio as gr
2
+ # from diffusers import DiffusionPipeline
3
+
4
+ # # get_completion = pipeline("image-to-text",model="nlpconnect/vit-gpt2-image-captioning")
5
+
6
+ # pipeline = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")
7
 
8
+ # # def summarize(input):
9
+ # # output = get_completion(input)
10
+ # # return output[0]['generated_text']
11
 
12
+ # # def captioner(image):
13
+ # # result = get_completion(image)
14
+ # # return result[0]['generated_text']
15
 
16
+ # def generate(prompt):
17
+ # return pipeline(prompt).images[0]
 
18
 
19
+ # gr.close_all()
20
+ # demo = gr.Interface(fn=generate,
21
+ # inputs=[gr.Textbox(label="Your prompt")],
22
+ # outputs=[gr.Image(label="Result")],
23
+ # title="Image Generation with Stable Diffusion",
24
+ # description="Generate any image with Stable Diffusion",
25
+ # allow_flagging="never",
26
+ # examples=["the spirit of a tamagotchi wandering in the city of Vienna","a mecha robot in a favela"])
27
 
28
+ # demo.launch()
 
29
 
 
 
 
 
 
 
 
 
30
 
31
+ import gradio as gr
32
+
33
+ gr.Interface.load("models/stabilityai/stable-diffusion-xl-base-1.0").launch()