Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +13 -0
- requirements.txt +4 -0
app.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from diffusers import StableDiffusionPipeline
|
| 3 |
+
|
| 4 |
+
# Load your model (make sure it's downloaded from Hugging Face)
|
| 5 |
+
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v-1-4-original")
|
| 6 |
+
|
| 7 |
+
# Define the function to generate the image
|
| 8 |
+
def generate_image(prompt):
|
| 9 |
+
image = pipe(prompt).images[0]
|
| 10 |
+
return image
|
| 11 |
+
|
| 12 |
+
# Set up Gradio interface
|
| 13 |
+
gr.Interface(fn=generate_image, inputs="text", outputs="image").launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
diffusers
|
| 3 |
+
torch
|
| 4 |
+
transformers
|