SeaWolf-AI commited on
Commit
cc5f8ce
·
verified ·
1 Parent(s): a8d8cbf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -18
app.py CHANGED
@@ -1,22 +1,15 @@
1
- import gradio as gr
 
 
2
  import os
3
 
4
- # index.html 읽기
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
- # Gradio의 기본 UI를 완전히 숨기고 index.html만 표시
13
- CSS = """
14
- footer { display: none !important; }
15
- .gradio-container { padding: 0 !important; margin: 0 !important; max-width: 100% !important; background: transparent !important; }
16
- #component-0 { padding: 0 !important; }
17
- """
18
 
19
- with gr.Blocks() as app:
20
- gr.HTML(HTML_CONTENT)
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)