maylinejix commited on
Commit
103f09f
·
verified ·
1 Parent(s): dc559ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -85,8 +85,13 @@ async def transcribe_url(
85
  language: str = Form(default="auto")
86
  ):
87
  try:
88
- async with httpx.AsyncClient(timeout=60) as client:
89
- r = await client.get(url)
 
 
 
 
 
90
  r.raise_for_status()
91
  except Exception as e:
92
  return JSONResponse({"error": f"Failed to download: {str(e)}"}, status_code=400)
@@ -121,4 +126,4 @@ async def health():
121
  return {"status": "ok", "model": "whisper-base"}
122
 
123
  if __name__ == "__main__":
124
- uvicorn.run(app, host="0.0.0.0", port=7860)
 
85
  language: str = Form(default="auto")
86
  ):
87
  try:
88
+ async with httpx.AsyncClient(timeout=60, follow_redirects=True) as client:
89
+ r = await client.get(url, headers={
90
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
91
+ "Accept": "*/*",
92
+ "Accept-Language": "en-US,en;q=0.9",
93
+ "Referer": "https://www.google.com/"
94
+ })
95
  r.raise_for_status()
96
  except Exception as e:
97
  return JSONResponse({"error": f"Failed to download: {str(e)}"}, status_code=400)
 
126
  return {"status": "ok", "model": "whisper-base"}
127
 
128
  if __name__ == "__main__":
129
+ uvicorn.run(app, host="0.0.0.0", port=7860)