Update app.py
Browse files
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 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
gr.
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
if __name__ == "__main__":
|
| 91 |
-
|
|
|
|
| 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()
|