Spaces:
Sleeping
Sleeping
AshDavid12
commited on
Commit
·
ec5dec0
1
Parent(s):
f05b2dd
logging error 404
Browse files
infer.py
CHANGED
@@ -9,7 +9,7 @@ from pydantic import BaseModel
|
|
9 |
from typing import Optional
|
10 |
|
11 |
# Configure logging
|
12 |
-
logging.basicConfig(level=logging.
|
13 |
|
14 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
15 |
logging.info(f'Device selected: {device}')
|
@@ -73,7 +73,7 @@ def download_file(url, max_size_bytes, output_filename, api_key=None):
|
|
73 |
|
74 |
@app.post("/transcribe")
|
75 |
async def transcribe(input_data: InputData):
|
76 |
-
logging.
|
77 |
datatype = input_data.type
|
78 |
if not datatype:
|
79 |
logging.error('datatype field not provided')
|
@@ -100,7 +100,7 @@ async def transcribe(input_data: InputData):
|
|
100 |
logging.error("Missing 'url' for 'url' input")
|
101 |
raise HTTPException(status_code=400, detail="Missing 'url' for 'url' input.")
|
102 |
logging.info(f'Downloading file from URL: {input_data.url}')
|
103 |
-
success = download_file(input_data.url, MAX_PAYLOAD_SIZE, audio_file,
|
104 |
if not success:
|
105 |
logging.error(f"Error downloading data from {input_data.url}")
|
106 |
raise HTTPException(status_code=400, detail=f"Error downloading data from {input_data.url}")
|
|
|
9 |
from typing import Optional
|
10 |
|
11 |
# Configure logging
|
12 |
+
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
13 |
|
14 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
15 |
logging.info(f'Device selected: {device}')
|
|
|
73 |
|
74 |
@app.post("/transcribe")
|
75 |
async def transcribe(input_data: InputData):
|
76 |
+
logging.INFO(f'Received transcription request with data: {input_data}')
|
77 |
datatype = input_data.type
|
78 |
if not datatype:
|
79 |
logging.error('datatype field not provided')
|
|
|
100 |
logging.error("Missing 'url' for 'url' input")
|
101 |
raise HTTPException(status_code=400, detail="Missing 'url' for 'url' input.")
|
102 |
logging.info(f'Downloading file from URL: {input_data.url}')
|
103 |
+
success = download_file(input_data.url, MAX_PAYLOAD_SIZE, audio_file, None)
|
104 |
if not success:
|
105 |
logging.error(f"Error downloading data from {input_data.url}")
|
106 |
raise HTTPException(status_code=400, detail=f"Error downloading data from {input_data.url}")
|