Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -172,10 +172,10 @@ async def transcribe_and_match(
|
|
172 |
audio.export(raw_audio, format="wav")
|
173 |
raw_audio.seek(0)
|
174 |
|
175 |
-
# Convert audio to samples as NumPy array
|
176 |
-
samples = np.array(audio.get_array_of_samples())
|
177 |
|
178 |
-
# Step 2: Use the speech-to-text model (expecting NumPy array)
|
179 |
transcription_result = nlp_speech_to_text(samples)
|
180 |
transcription_text = transcription_result['text']
|
181 |
|
@@ -202,7 +202,6 @@ async def transcribe_and_match(
|
|
202 |
except Exception as e:
|
203 |
return JSONResponse(content=f"Error processing audio or matching fields: {str(e)}", status_code=500)
|
204 |
|
205 |
-
|
206 |
# Set up CORS middleware
|
207 |
origins = ["*"] # or specify your list of allowed origins
|
208 |
app.add_middleware(
|
|
|
172 |
audio.export(raw_audio, format="wav")
|
173 |
raw_audio.seek(0)
|
174 |
|
175 |
+
# Convert audio to samples as NumPy array (convert to float64)
|
176 |
+
samples = np.array(audio.get_array_of_samples()).astype(np.float64)
|
177 |
|
178 |
+
# Step 2: Use the speech-to-text model (expecting NumPy array of float64)
|
179 |
transcription_result = nlp_speech_to_text(samples)
|
180 |
transcription_text = transcription_result['text']
|
181 |
|
|
|
202 |
except Exception as e:
|
203 |
return JSONResponse(content=f"Error processing audio or matching fields: {str(e)}", status_code=500)
|
204 |
|
|
|
205 |
# Set up CORS middleware
|
206 |
origins = ["*"] # or specify your list of allowed origins
|
207 |
app.add_middleware(
|