Update app.py
Browse files
app.py
CHANGED
@@ -85,18 +85,21 @@ def draw_detected_objects(image, detections, score_threshold=0.5):
|
|
85 |
|
86 |
return annotated_image
|
87 |
|
88 |
-
# Gradio function
|
89 |
def detect_image(image):
|
90 |
try:
|
91 |
-
|
92 |
-
output
|
93 |
-
processed_image = draw_detected_objects(raw_image, output)
|
94 |
natural_text = read_objects(output)
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
97 |
except Exception as e:
|
98 |
-
print("β Error:", e)
|
99 |
-
return
|
|
|
|
|
100 |
|
101 |
# Launch Gradio app
|
102 |
demo = gr.Interface(
|
|
|
85 |
|
86 |
return annotated_image
|
87 |
|
|
|
88 |
def detect_image(image):
|
89 |
try:
|
90 |
+
output = obj_detector(image)
|
91 |
+
print("β
Detection output:", output)
|
|
|
92 |
natural_text = read_objects(output)
|
93 |
+
print("π Generated Text:", natural_text)
|
94 |
+
audio_path = generate_audio(natural_text)
|
95 |
+
print("π Audio Path:", audio_path)
|
96 |
+
processed_image = draw_detected_objects(image, output)
|
97 |
+
return processed_image, audio_path
|
98 |
except Exception as e:
|
99 |
+
print("β Error:", str(e))
|
100 |
+
return Image.new("RGB", (512, 512), color="gray"), None
|
101 |
+
|
102 |
+
|
103 |
|
104 |
# Launch Gradio app
|
105 |
demo = gr.Interface(
|