Spaces:
Running
Running
123LETSPLAY
commited on
Commit
•
9978c3d
1
Parent(s):
c81f995
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from diffusers import DiffusionPipeline
|
3 |
+
|
4 |
+
# Load the SHAP-E diffusion pipeline
|
5 |
+
pipe = DiffusionPipeline.from_pretrained("openai/shap-e")
|
6 |
+
|
7 |
+
def generate_image(prompt):
|
8 |
+
# Generate the image from the prompt
|
9 |
+
image = pipe(prompt).images[0]
|
10 |
+
return image
|
11 |
+
|
12 |
+
# Create a Gradio interface
|
13 |
+
iface = gr.Interface(
|
14 |
+
fn=generate_image,
|
15 |
+
inputs=gr.Textbox(label="Enter your prompt", placeholder="e.g. Astronaut in a jungle"),
|
16 |
+
outputs=gr.Image(label="Generated Image"),
|
17 |
+
title="SHAP-E Image Generator",
|
18 |
+
description="Generate images using the SHAP-E diffusion model based on your prompts."
|
19 |
+
)
|
20 |
+
|
21 |
+
if __name__ == "__main__":
|
22 |
+
iface.launch()
|