agnik1107 commited on
Commit
267995f
·
verified ·
1 Parent(s): 56b887b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -12
app.py CHANGED
@@ -75,17 +75,25 @@ def process_image(image):
75
  print(f"Error: {str(e)}")
76
  return f"Error processing image: {str(e)}", None
77
 
78
- # Create Gradio interface
79
- iface = gr.Interface(
80
- fn=process_image,
81
- inputs=gr.Image(type="pil"),
82
- outputs=[
83
- gr.Textbox(label="Image Description (Gemini)", lines=15),
84
- gr.Image(label="Generated Image (FLUX.1-dev)")
85
- ],
86
- title="Image Analysis and Generation",
87
- description="Upload an image to get a detailed description from Gemini, then generate a new image based on that description using FLUX.1-dev."
88
- )
 
 
 
 
 
 
 
 
89
 
90
  if __name__ == "__main__":
91
- iface.launch()
 
75
  print(f"Error: {str(e)}")
76
  return f"Error processing image: {str(e)}", None
77
 
78
+ # Create a simpler Gradio interface to avoid compatibility issues
79
+ with gr.Blocks() as demo:
80
+ gr.Markdown("# Image Analysis and Generation")
81
+ gr.Markdown("Upload an image to get a detailed description from Gemini, then generate a new image based on that description using FLUX.1-dev.")
82
+
83
+ with gr.Row():
84
+ with gr.Column():
85
+ input_image = gr.Image(type="pil")
86
+ submit_btn = gr.Button("Analyze and Generate")
87
+
88
+ with gr.Column():
89
+ output_text = gr.Textbox(lines=15, label="Image Description")
90
+ output_image = gr.Image(label="Generated Image")
91
+
92
+ submit_btn.click(
93
+ fn=process_image,
94
+ inputs=input_image,
95
+ outputs=[output_text, output_image]
96
+ )
97
 
98
  if __name__ == "__main__":
99
+ demo.launch()