Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,11 @@
|
|
1 |
-
from fastapi import FastAPI, HTTPException,
|
2 |
from fastapi.middleware.cors import CORSMiddleware
|
3 |
-
from
|
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,8 +31,9 @@ async def root():
|
|
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/")
|
|
|
1 |
+
from fastapi import FastAPI, HTTPException, UploadFile
|
2 |
from fastapi.middleware.cors import CORSMiddleware
|
3 |
+
from fastapi import FastAPI, UploadFile
|
|
|
|
|
|
|
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 |
|
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, "file_to_text": fileToText}
|
37 |
|
38 |
|
39 |
@app.post("/contextText/")
|