LiamKhoaLe commited on
Commit
0de97e7
·
1 Parent(s): 9d2cd2a

Connect nondirect whisper api

Browse files
Files changed (2) hide show
  1. .gitignore +1 -1
  2. app.py +4 -4
.gitignore CHANGED
@@ -1,2 +1,2 @@
1
  .env
2
- test.py
 
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("https://openai-whisper.hf.space/")
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), # ✅ wrap with handle_file for local path
381
- "transcribe",
382
- api_name="/predict" # or "/predict_1" if that fails
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)