Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,14 +9,12 @@ pipeline = pipeline.to("cuda" if torch.cuda.is_available() else "cpu")
|
|
| 9 |
def generate_image(prompt):
|
| 10 |
# Generate an image based on the prompt using the pipeline
|
| 11 |
output = pipeline(prompt)
|
| 12 |
-
# Assuming that the output has a `images` field with a list of images
|
| 13 |
return output.images[0]
|
| 14 |
|
| 15 |
-
#
|
| 16 |
title = "Shap-E Model Demo"
|
| 17 |
description = "Generate images from text prompts using the Shap-E diffusion model."
|
| 18 |
|
| 19 |
-
# Set up the interface
|
| 20 |
interface = gr.Interface(
|
| 21 |
fn=generate_image,
|
| 22 |
inputs=gr.Textbox(label="Prompt"),
|
|
@@ -25,6 +23,5 @@ interface = gr.Interface(
|
|
| 25 |
description=description,
|
| 26 |
)
|
| 27 |
|
| 28 |
-
# Launch the Gradio app
|
| 29 |
if __name__ == "__main__":
|
| 30 |
interface.launch()
|
|
|
|
| 9 |
def generate_image(prompt):
|
| 10 |
# Generate an image based on the prompt using the pipeline
|
| 11 |
output = pipeline(prompt)
|
|
|
|
| 12 |
return output.images[0]
|
| 13 |
|
| 14 |
+
# Gradio interface setup
|
| 15 |
title = "Shap-E Model Demo"
|
| 16 |
description = "Generate images from text prompts using the Shap-E diffusion model."
|
| 17 |
|
|
|
|
| 18 |
interface = gr.Interface(
|
| 19 |
fn=generate_image,
|
| 20 |
inputs=gr.Textbox(label="Prompt"),
|
|
|
|
| 23 |
description=description,
|
| 24 |
)
|
| 25 |
|
|
|
|
| 26 |
if __name__ == "__main__":
|
| 27 |
interface.launch()
|