robinhad commited on
Commit
fa39f45
·
verified ·
1 Parent(s): f8277ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -16,6 +16,7 @@ from fastapi.responses import JSONResponse
16
  import uvicorn
17
  from starlette.middleware.base import BaseHTTPMiddleware
18
  import logging
 
19
 
20
  # Configure logging
21
  logging.basicConfig(level=logging.INFO)
@@ -123,7 +124,11 @@ async def translate(
123
  raise HTTPException(
124
  status_code=400, detail={"message": "Missing required parameters"}
125
  )
126
- data = await request.json()
 
 
 
 
127
  strings = data.get("strings", [])
128
 
129
  if not strings:
 
16
  import uvicorn
17
  from starlette.middleware.base import BaseHTTPMiddleware
18
  import logging
19
+ import json
20
 
21
  # Configure logging
22
  logging.basicConfig(level=logging.INFO)
 
124
  raise HTTPException(
125
  status_code=400, detail={"message": "Missing required parameters"}
126
  )
127
+ try:
128
+ data = await request.json()
129
+ except:
130
+ data = await request.body()
131
+ data = json.loads(data)
132
  strings = data.get("strings", [])
133
 
134
  if not strings: