harshp3030 commited on
Commit
a1e4316
·
1 Parent(s): fc4eaf7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -11
app.py CHANGED
@@ -1,13 +1,10 @@
1
- import gradio as gr
 
2
  import torch
3
- from diffusers import StableDiffusionPipeline
4
 
5
- pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float16)
6
-
7
- def diffusion(prompt, filename):
8
- image = pipe(prompt).images[0]
9
- image.save(filename)
10
- return image
11
-
12
- iface = gr.Interface(fn=diffusion, inputs="text", outputs="image")
13
- iface.launch()
 
1
+ import gradio as gr
2
+ from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
3
  import torch
 
4
 
5
+ def txt2img(prompt):
6
+ image = pipe(prompt, height=768, width=768, guidance_scale = 10).images[0]
7
+ # image.save("sd_image.png")
8
+ return image
9
+
10
+ gr.Interface(txt2img, gr.Text(), gr.Image(), title = 'Stable Diffusion 2.0 Colab with Gradio UI').launch(share = True, debug = True)