Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
| 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",
|