Spaces:
Runtime error
Runtime error
Commit ·
0de97e7
1
Parent(s): 9d2cd2a
Connect nondirect whisper api
Browse files- .gitignore +1 -1
- app.py +4 -4
.gitignore
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
.env
|
| 2 |
-
test
|
|
|
|
| 1 |
.env
|
| 2 |
+
test
|
app.py
CHANGED
|
@@ -361,7 +361,7 @@ from gradio_client import Client, handle_file
|
|
| 361 |
import tempfile
|
| 362 |
import os
|
| 363 |
# Use whisper from gradio client
|
| 364 |
-
whisper_client = Client("
|
| 365 |
logger.info("[Whisper] Using remote Whisper API via Gradio Client")
|
| 366 |
# Endpoint
|
| 367 |
@app.post("/voice-transcribe")
|
|
@@ -377,9 +377,9 @@ async def voice_transcribe(file: UploadFile = File(...)):
|
|
| 377 |
logger.info(f"[Whisper] File saved to: {tmp_path}, sending to API...")
|
| 378 |
# Predict on client call
|
| 379 |
result = whisper_client.predict(
|
| 380 |
-
handle_file(tmp_path),
|
| 381 |
-
"
|
| 382 |
-
api_name="/predict"
|
| 383 |
)
|
| 384 |
# Clean cache after use
|
| 385 |
os.remove(tmp_path)
|
|
|
|
| 361 |
import tempfile
|
| 362 |
import os
|
| 363 |
# Use whisper from gradio client
|
| 364 |
+
whisper_client = Client("freddyaboulton/really-fast-whisper")
|
| 365 |
logger.info("[Whisper] Using remote Whisper API via Gradio Client")
|
| 366 |
# Endpoint
|
| 367 |
@app.post("/voice-transcribe")
|
|
|
|
| 377 |
logger.info(f"[Whisper] File saved to: {tmp_path}, sending to API...")
|
| 378 |
# Predict on client call
|
| 379 |
result = whisper_client.predict(
|
| 380 |
+
audio=handle_file(tmp_path),
|
| 381 |
+
language="<|en|>",
|
| 382 |
+
api_name="/predict"
|
| 383 |
)
|
| 384 |
# Clean cache after use
|
| 385 |
os.remove(tmp_path)
|