Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
from typing import Union
|
2 |
import csv
|
3 |
from fastapi import FastAPI
|
|
|
|
|
4 |
|
5 |
app = FastAPI()
|
6 |
|
@@ -15,8 +17,14 @@ def load_data(filename):
|
|
15 |
|
16 |
|
17 |
new_list = load_data('country.csv')
|
18 |
-
|
19 |
-
@app.get("/")
|
20 |
-
def
|
21 |
-
return {"
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from typing import Union
|
2 |
import csv
|
3 |
from fastapi import FastAPI
|
4 |
+
from fastapi.staticfiles import StaticFiles
|
5 |
+
from fastapi.responses import FileResponse
|
6 |
|
7 |
app = FastAPI()
|
8 |
|
|
|
17 |
|
18 |
|
19 |
new_list = load_data('country.csv')
|
20 |
+
|
21 |
+
@app.get("/getdata")
|
22 |
+
def getData():
|
23 |
+
return {"data": new_list}}
|
24 |
+
|
25 |
+
app.mount('/',StaticFiles(directory="static",html=True),name="static")
|
26 |
+
|
27 |
+
@app.get('/')
|
28 |
+
def index() -> FileResponse:
|
29 |
+
return FileResponse('/app/static/index.html',media_type="text/html")
|
30 |
+
|