Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,13 @@
|
|
1 |
-
from fastapi import FastAPI, HTTPException, UploadFile
|
2 |
from fastapi.middleware.cors import CORSMiddleware
|
3 |
-
from
|
|
|
|
|
|
|
4 |
from typing import Union
|
5 |
import json
|
6 |
import csv
|
7 |
from modeles import bert, squeezebert, deberta
|
8 |
-
from uploadFile import file_to_text
|
9 |
|
10 |
|
11 |
app = FastAPI()
|
@@ -31,9 +33,8 @@ async def root():
|
|
31 |
|
32 |
@app.post("/uploadfile/")
|
33 |
async def create_upload_file(file: UploadFile, texte: str, model: str):
|
34 |
-
fileToText = await file_to_text(file)
|
35 |
|
36 |
-
return {"model": model, "texte": texte, "filename": file.filename
|
37 |
|
38 |
|
39 |
@app.post("/contextText/")
|
@@ -105,4 +106,4 @@ def extract_data(file: UploadFile) -> Union[str, dict, list]:
|
|
105 |
data = file.file.read().decode("utf-8")
|
106 |
return json.loads(data)
|
107 |
else:
|
108 |
-
return "Invalid file format"
|
|
|
1 |
+
from fastapi import FastAPI, HTTPException, File, UploadFile
|
2 |
from fastapi.middleware.cors import CORSMiddleware
|
3 |
+
from typing import Annotated
|
4 |
+
from pydantic import BaseModel
|
5 |
+
import uvicorn
|
6 |
+
from fastapi import FastAPI, UploadFile, File
|
7 |
from typing import Union
|
8 |
import json
|
9 |
import csv
|
10 |
from modeles import bert, squeezebert, deberta
|
|
|
11 |
|
12 |
|
13 |
app = FastAPI()
|
|
|
33 |
|
34 |
@app.post("/uploadfile/")
|
35 |
async def create_upload_file(file: UploadFile, texte: str, model: str):
|
|
|
36 |
|
37 |
+
return {"model": model, "texte": texte, "filename": file.filename}
|
38 |
|
39 |
|
40 |
@app.post("/contextText/")
|
|
|
106 |
data = file.file.read().decode("utf-8")
|
107 |
return json.loads(data)
|
108 |
else:
|
109 |
+
return "Invalid file format"
|