Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -43,16 +43,25 @@ def generate_image(prompt, max_retries=5):
|
|
43 |
# This line should never be reached, but just in case:
|
44 |
return None, "Unexpected error occurred"
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
gr.
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
logger.info("Launching the Gradio interface...")
|
58 |
-
|
|
|
43 |
# This line should never be reached, but just in case:
|
44 |
return None, "Unexpected error occurred"
|
45 |
|
46 |
+
with gr.Blocks() as demo:
|
47 |
+
gr.Markdown("# Text-to-Image Generation")
|
48 |
+
gr.Markdown("Enter a prompt to generate an image. The system will automatically retry up to 5 times if an error occurs.")
|
49 |
+
|
50 |
+
with gr.Row():
|
51 |
+
with gr.Column(scale=2):
|
52 |
+
input_text = gr.Textbox(label="Enter your prompt")
|
53 |
+
generate_btn = gr.Button("Generate")
|
54 |
+
image_output = gr.Image(label="Generated Image")
|
55 |
+
info_output = gr.Textbox(label="Output Information", lines=5)
|
56 |
+
|
57 |
+
with gr.Column(scale=1):
|
58 |
+
file_explorer = gr.FileExplorer(label="File System")
|
59 |
+
|
60 |
+
generate_btn.click(
|
61 |
+
generate_image,
|
62 |
+
inputs=input_text,
|
63 |
+
outputs=[image_output, info_output]
|
64 |
+
)
|
65 |
|
66 |
logger.info("Launching the Gradio interface...")
|
67 |
+
demo.launch()
|