Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,15 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
| 2 |
import os
|
| 3 |
|
| 4 |
-
|
| 5 |
-
html_path = os.path.join(os.path.dirname(os.path.abspath(__file__)) if "__file__" in dir() else ".", "index.html")
|
| 6 |
-
if os.path.exists(html_path):
|
| 7 |
-
with open(html_path, "r", encoding="utf-8") as f:
|
| 8 |
-
HTML_CONTENT = f.read()
|
| 9 |
-
else:
|
| 10 |
-
HTML_CONTENT = "<h1>index.html 파일을 찾을 수 없습니다.</h1>"
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
#component-0 { padding: 0 !important; }
|
| 17 |
-
"""
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
app.launch(server_name="0.0.0.0", ssr_mode=False, css=CSS)
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from fastapi.responses import HTMLResponse
|
| 3 |
+
from fastapi.staticfiles import StaticFiles
|
| 4 |
import os
|
| 5 |
|
| 6 |
+
app = FastAPI()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
@app.get("/", response_class=HTMLResponse)
|
| 9 |
+
def root():
|
| 10 |
+
with open("index.html", "r", encoding="utf-8") as f:
|
| 11 |
+
return f.read()
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
if __name__ == "__main__":
|
| 14 |
+
import uvicorn
|
| 15 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|