Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,12 +27,13 @@ def extract_from_audio(audio_file):
|
|
| 27 |
if audio_file is None:
|
| 28 |
return "Error: No audio provided."
|
| 29 |
|
| 30 |
-
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
| 31 |
-
|
| 32 |
-
|
| 33 |
|
| 34 |
try:
|
| 35 |
-
segments = address_extractor.whisper_model.transcribe(tmp_file_path)
|
|
|
|
| 36 |
input_text = " ".join([seg.text.strip() for seg in segments])
|
| 37 |
input_text = address_extractor.preprocess_text(input_text)
|
| 38 |
|
|
|
|
| 27 |
if audio_file is None:
|
| 28 |
return "Error: No audio provided."
|
| 29 |
|
| 30 |
+
# with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
| 31 |
+
# tmp_file.write(audio_file.read())
|
| 32 |
+
# tmp_file_path = tmp_file.name
|
| 33 |
|
| 34 |
try:
|
| 35 |
+
# segments = address_extractor.whisper_model.transcribe(tmp_file_path)
|
| 36 |
+
segments = address_extractor.whisper_model.transcribe(audio_file)
|
| 37 |
input_text = " ".join([seg.text.strip() for seg in segments])
|
| 38 |
input_text = address_extractor.preprocess_text(input_text)
|
| 39 |
|