xpvwklvjp commited on
Commit
d029e8e
·
verified ·
1 Parent(s): 5516baa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -20
app.py CHANGED
@@ -43,25 +43,16 @@ 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
- 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()
 
43
  # This line should never be reached, but just in case:
44
  return None, "Unexpected error occurred"
45
 
46
+ iface = gr.Interface(
47
+ fn=generate_image,
48
+ inputs=gr.Textbox(label="Enter your prompt"),
49
+ outputs=[
50
+ gr.Image(label="Generated Image"),
51
+ gr.Textbox(label="Output Information", lines=5)
52
+ ],
53
+ title="Text-to-Image Generation",
54
+ description="Enter a prompt to generate an image. The system will automatically retry up to 5 times if an error occurs."
55
+ )
 
 
 
 
 
 
 
 
 
56
 
57
  logger.info("Launching the Gradio interface...")
58
+ iface.launch()