Miraj3 commited on
Commit
0ede05a
Β·
verified Β·
1 Parent(s): 2041b7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
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
- raw_image = image
92
- output = obj_detector(raw_image)
93
- processed_image = draw_detected_objects(raw_image, output)
94
  natural_text = read_objects(output)
95
- processed_audio = generate_audio(natural_text)
96
- return processed_image, processed_audio
 
 
 
97
  except Exception as e:
98
- print("❌ Error:", e)
99
- return None, None
 
 
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(