Spaces:
Sleeping
Sleeping
File size: 1,001 Bytes
b65ff94 86b66ac b65ff94 86b66ac 57d2857 86b66ac 81c6701 86b66ac 1324f5f 86b66ac 8d38e56 57d2857 8d38e56 b65ff94 8d38e56 72173aa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
from fastapi import FastAPI, File, Form, UploadFile, HTTPException
from fastapi.responses import JSONResponse, Response
from utils import extract_json_from_images
import numpy as np
from pydantic import BaseModel
from pathlib import Path
import time
from typing import List
# Load the FHE server
# FHE_SERVER = FHEModelServer(DEPLOYMENT_DIR)
class Symptoms(BaseModel):
user_symptoms: List[str]
app = FastAPI()
@app.post("/extract-json")
async def extract_json(files: List[UploadFile] = File(...)):
try:
# Read the uploaded images
uploaded_images = [file.file for file in files]
# Extract JSON from images
json_data = extract_json_from_images(uploaded_images)
# Close the file objects
for file in uploaded_images:
file.close()
return JSONResponse(content=json_data)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
@app.get("/")
def greet_json():
return {"Hello": "Zama!"} |