Update app.py
Browse files
app.py
CHANGED
|
@@ -378,12 +378,12 @@ def vqa_answer(image, question):
|
|
| 378 |
answer = vqa_processor.decode(out[0], skip_special_tokens=True)
|
| 379 |
|
| 380 |
if not is_caption_safe(answer):
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
|
| 388 |
|
| 389 |
return answer, None
|
|
|
|
| 378 |
answer = vqa_processor.decode(out[0], skip_special_tokens=True)
|
| 379 |
|
| 380 |
if not is_caption_safe(answer):
|
| 381 |
+
beep = make_beep_sound()
|
| 382 |
+
tts = gTTS("Warning! Unsafe or inappropriate content detected.", lang="en")
|
| 383 |
+
speech_tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".mp3")
|
| 384 |
+
tts.save(speech_tmp.name)
|
| 385 |
+
combined = combine_audio(beep, speech_tmp.name)
|
| 386 |
+
return "⚠️ Warning: Unsafe or inappropriate content detected!", combined
|
| 387 |
|
| 388 |
|
| 389 |
return answer, None
|