Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -97,7 +97,29 @@ def process_and_analyze(image):
|
|
97 |
except Exception as e:
|
98 |
return None, f"Error processing image: {str(e)}"
|
99 |
|
100 |
-
# Create Gradio interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
if __name__ == "__main__":
|
|
|
103 |
demo.launch()
|
|
|
97 |
except Exception as e:
|
98 |
return None, f"Error processing image: {str(e)}"
|
99 |
|
100 |
+
# Create Gradio interface
|
101 |
+
def create_interface():
|
102 |
+
with gr.Blocks() as demo:
|
103 |
+
gr.Markdown("# Image Surprise Analysis")
|
104 |
+
|
105 |
+
with gr.Row():
|
106 |
+
with gr.Column():
|
107 |
+
input_image = gr.Image(label="Upload Image")
|
108 |
+
analyze_btn = gr.Button("Analyze Image")
|
109 |
+
|
110 |
+
with gr.Column():
|
111 |
+
output_image = gr.Image(label="Processed Image")
|
112 |
+
output_text = gr.Textbox(label="Analysis Results")
|
113 |
+
|
114 |
+
analyze_btn.click(
|
115 |
+
fn=process_and_analyze,
|
116 |
+
inputs=[input_image],
|
117 |
+
outputs=[output_image, output_text]
|
118 |
+
)
|
119 |
+
|
120 |
+
return demo
|
121 |
+
|
122 |
|
123 |
if __name__ == "__main__":
|
124 |
+
demo = create_interface()
|
125 |
demo.launch()
|