fdsodfs commited on
Commit
3b213f1
1 Parent(s): 5244c19
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ flagged/
.ipynb_checkpoints/.gitignore-checkpoint ADDED
@@ -0,0 +1 @@
 
 
1
+ flagged/
.ipynb_checkpoints/README-checkpoint.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Stablepod
3
+ emoji: 🌖
4
+ colorFrom: pink
5
+ colorTo: red
6
+ sdk: gradio
7
+ sdk_version: 3.4
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
.ipynb_checkpoints/app-checkpoint.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import torch
3
+ from torch import autocast
4
+ from diffusers import StableDiffusionPipeline
5
+
6
+
7
+ def get_stable_diffusion_random_image(prompt):
8
+ model_id = "CompVis/stable-diffusion-v1-4"
9
+ device = "cuda"
10
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
11
+ pipe = pipe.to(device)
12
+ with autocast("cuda"):
13
+ image = pipe(prompt, guidance_scale=7.5).images[0]
14
+ return image
15
+
16
+
17
+ iface = gr.Interface(fn=get_stable_diffusion_random_image, inputs="text", outputs="image")
18
+ iface.launch(share=True)
app.py CHANGED
@@ -1,7 +1,18 @@
1
  import gradio as gr
 
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import torch
3
+ from torch import autocast
4
+ from diffusers import StableDiffusionPipeline
5
 
 
 
6
 
7
+ def get_stable_diffusion_random_image(prompt):
8
+ model_id = "CompVis/stable-diffusion-v1-4"
9
+ device = "cuda"
10
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
11
+ pipe = pipe.to(device)
12
+ with autocast("cuda"):
13
+ image = pipe(prompt, guidance_scale=7.5).images[0]
14
+ return image
15
+
16
+
17
+ iface = gr.Interface(fn=get_stable_diffusion_random_image, inputs="text", outputs="image")
18
+ iface.launch(share=True)