Update app.py
Browse files
app.py
CHANGED
|
@@ -330,8 +330,9 @@ async def signup(user: UserCreate, db: Session = Depends(get_db)):
|
|
| 330 |
created = create_user(db=db, user=user)
|
| 331 |
return created
|
| 332 |
|
|
|
|
| 333 |
@app.post("/process/", response_model=OCRResponse)
|
| 334 |
-
async def process(file: UploadFile = File(...)
|
| 335 |
if not file.content_type.startswith("image/"):
|
| 336 |
raise HTTPException(status_code=400, detail="File must be an image")
|
| 337 |
|
|
@@ -360,14 +361,16 @@ async def process(file: UploadFile = File(...), current_user: UserModel = Depend
|
|
| 360 |
finally:
|
| 361 |
os.unlink(temp_file.name)
|
| 362 |
|
|
|
|
| 363 |
@app.get("/word-detection/")
|
| 364 |
-
async def get_word_detection(
|
| 365 |
if 'word_detection' not in session_files or not os.path.exists(session_files['word_detection']):
|
| 366 |
raise HTTPException(status_code=404, detail="Word detection image not found")
|
| 367 |
return FileResponse(session_files['word_detection'])
|
| 368 |
|
|
|
|
| 369 |
@app.get("/prediction/")
|
| 370 |
-
async def get_prediction(
|
| 371 |
if 'prediction' not in session_files or not os.path.exists(session_files['prediction']):
|
| 372 |
raise HTTPException(status_code=404, detail="Prediction image not found")
|
| 373 |
return FileResponse(session_files['prediction'])
|
|
@@ -394,4 +397,4 @@ async def admin_get_feedback(skip: int = 0, limit: int = 100, current_user: User
|
|
| 394 |
return get_feedback(db, skip=skip, limit=limit)
|
| 395 |
|
| 396 |
if __name__ == "__main__":
|
| 397 |
-
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
|
|
| 330 |
created = create_user(db=db, user=user)
|
| 331 |
return created
|
| 332 |
|
| 333 |
+
# MODIFIED: Removed authentication dependency
|
| 334 |
@app.post("/process/", response_model=OCRResponse)
|
| 335 |
+
async def process(file: UploadFile = File(...)):
|
| 336 |
if not file.content_type.startswith("image/"):
|
| 337 |
raise HTTPException(status_code=400, detail="File must be an image")
|
| 338 |
|
|
|
|
| 361 |
finally:
|
| 362 |
os.unlink(temp_file.name)
|
| 363 |
|
| 364 |
+
# MODIFIED: Removed authentication dependency
|
| 365 |
@app.get("/word-detection/")
|
| 366 |
+
async def get_word_detection():
|
| 367 |
if 'word_detection' not in session_files or not os.path.exists(session_files['word_detection']):
|
| 368 |
raise HTTPException(status_code=404, detail="Word detection image not found")
|
| 369 |
return FileResponse(session_files['word_detection'])
|
| 370 |
|
| 371 |
+
# MODIFIED: Removed authentication dependency
|
| 372 |
@app.get("/prediction/")
|
| 373 |
+
async def get_prediction():
|
| 374 |
if 'prediction' not in session_files or not os.path.exists(session_files['prediction']):
|
| 375 |
raise HTTPException(status_code=404, detail="Prediction image not found")
|
| 376 |
return FileResponse(session_files['prediction'])
|
|
|
|
| 397 |
return get_feedback(db, skip=skip, limit=limit)
|
| 398 |
|
| 399 |
if __name__ == "__main__":
|
| 400 |
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|