Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -74,9 +74,22 @@ def transcribe_audio(audio_path):
|
|
| 74 |
print("Audio received:", audio_path)
|
| 75 |
|
| 76 |
if audio_path is None:
|
| 77 |
-
return "
|
| 78 |
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
# ── CSS ──────────────────────────────────────────────────────────────────────
|
| 82 |
css = """
|
|
|
|
| 74 |
print("Audio received:", audio_path)
|
| 75 |
|
| 76 |
if audio_path is None:
|
| 77 |
+
return ""
|
| 78 |
|
| 79 |
+
try:
|
| 80 |
+
with open(audio_path, "rb") as audio_file:
|
| 81 |
+
result = speech_client.audio_to_text(audio_file)
|
| 82 |
+
|
| 83 |
+
print("Result:", result)
|
| 84 |
+
|
| 85 |
+
if hasattr(result, "text"):
|
| 86 |
+
return result.text
|
| 87 |
+
|
| 88 |
+
return str(result)
|
| 89 |
+
|
| 90 |
+
except Exception as e:
|
| 91 |
+
print("VOICE ERROR:", repr(e))
|
| 92 |
+
return f"Voice transcription failed: {repr(e)}"
|
| 93 |
|
| 94 |
# ── CSS ──────────────────────────────────────────────────────────────────────
|
| 95 |
css = """
|