Spaces:
Runtime error
Runtime error
dinhquangson
commited on
Commit
•
a5245e5
1
Parent(s):
3329abf
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI, UploadFile, File
|
2 |
+
from fastapi.middleware.cors import CORSMiddleware
|
3 |
+
|
4 |
+
app = FastAPI()
|
5 |
+
|
6 |
+
|
7 |
+
@app.post("/uploadfile/")
|
8 |
+
async def create_upload_file(file: UploadFile = File(...)):
|
9 |
+
# Here you can save the file and do other operations as needed
|
10 |
+
return {"filename": file.filename, "message": "Done"}
|
11 |
+
|
12 |
+
app.add_middleware(
|
13 |
+
CORSMiddleware,
|
14 |
+
allow_origins=["*"],
|
15 |
+
allow_credentials=True,
|
16 |
+
allow_methods=["*"],
|
17 |
+
allow_headers=["*"],
|
18 |
+
)
|
19 |
+
|
20 |
+
@app.get("/")
|
21 |
+
def api_home():
|
22 |
+
return {'detail': 'Welcome to FastAPI Qdrant importer!'}
|