ShiraSpeech commited on
Commit
f58d456
ยท
verified ยท
1 Parent(s): f5311ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -69,16 +69,14 @@ async def predict(data: PredictionRequest):
69
  @app.post("/transcribe")
70
  async def transcribe(file: UploadFile = File(...)):
71
  print(f"DEBUG: --- FILE RECEIVED: {file.filename}, SIZE: {file.size} ---")
72
- temp_path = f"temp_{uuid.uuid4()}_{file.filename}"
 
 
 
73
  try:
74
  with open(temp_path, "wb") as buffer:
75
  shutil.copyfileobj(file.file, buffer)
76
 
77
- # ื‘ื“ื™ืงื” ืื ื”ืงื•ื‘ืฅ ื ื•ืฆืจ
78
- if os.path.getsize(temp_path) == 0:
79
- print("DEBUG: --- ERROR: File saved as empty ---")
80
- return {"status": "error", "message": "File saved as empty"}
81
-
82
  result = whisper_model.transcribe(
83
  temp_path,
84
  language="he",
 
69
  @app.post("/transcribe")
70
  async def transcribe(file: UploadFile = File(...)):
71
  print(f"DEBUG: --- FILE RECEIVED: {file.filename}, SIZE: {file.size} ---")
72
+
73
+ # ื‘ืžืงื•ื ืœื”ืฉืชืžืฉ ื‘ืฉื ื”ืžื•ื–ืจ ืฉืœ ื”ืงื•ื‘ืฅ, ื ื™ืชืŸ ืœื• ืฉื ืงื‘ื•ืข ื•ืคืฉื•ื˜
74
+ temp_path = f"temp_{uuid.uuid4()}.mp3"
75
+
76
  try:
77
  with open(temp_path, "wb") as buffer:
78
  shutil.copyfileobj(file.file, buffer)
79
 
 
 
 
 
 
80
  result = whisper_model.transcribe(
81
  temp_path,
82
  language="he",