Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ def generate_audio(text):
|
|
25 |
return f.name
|
26 |
|
27 |
# Turn detections into human-friendly text
|
28 |
-
def read_objects(detections
|
29 |
if not detections:
|
30 |
return "No objects were detected in this picture."
|
31 |
|
@@ -99,10 +99,16 @@ def detect_image(image):
|
|
99 |
return None, None
|
100 |
|
101 |
# Launch Gradio app
|
102 |
-
gr.close_all()
|
103 |
-
|
104 |
demo = gr.Interface(
|
105 |
fn=detect_image,
|
106 |
inputs=[gr.Image(label="Upload an Image", type="pil")],
|
107 |
outputs=[
|
108 |
-
gr.Image(label="Image with
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
return f.name
|
26 |
|
27 |
# Turn detections into human-friendly text
|
28 |
+
def read_objects(detections):
|
29 |
if not detections:
|
30 |
return "No objects were detected in this picture."
|
31 |
|
|
|
99 |
return None, None
|
100 |
|
101 |
# Launch Gradio app
|
|
|
|
|
102 |
demo = gr.Interface(
|
103 |
fn=detect_image,
|
104 |
inputs=[gr.Image(label="Upload an Image", type="pil")],
|
105 |
outputs=[
|
106 |
+
gr.Image(label="Image with Detected Objects", type="pil"),
|
107 |
+
gr.Audio(label="Audio Description")
|
108 |
+
],
|
109 |
+
title="@GenAI Project 7: Object Detector with Audio",
|
110 |
+
description="This app detects objects in images, highlights them, and generates a natural language audio description."
|
111 |
+
)
|
112 |
+
|
113 |
+
demo.launch()
|
114 |
+
|