Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -403,7 +403,7 @@ with gr.Blocks(css=FULL_CSS, title="EVB Prognosis Calculator") as demo:
|
|
| 403 |
border:1px solid rgba(0,229,160,0.3);
|
| 404 |
transition:all 0.3s ease;
|
| 405 |
">🎨 Classic Mode</button>
|
| 406 |
-
<a href="/
|
| 407 |
padding:8px 16px; border-radius:8px; cursor:pointer;
|
| 408 |
font-size:12px; font-weight:600; letter-spacing:0.5px;
|
| 409 |
background:rgba(0,180,216,0.15); color:#00b4d8;
|
|
@@ -559,8 +559,36 @@ for the prediction of mortality in cirrhotic patients with acute esophageal vari
|
|
| 559 |
**Contact:** mmrech@ucs.br | **Version:** 3.0 (ONNX + Glassmorphism)
|
| 560 |
""")
|
| 561 |
|
| 562 |
-
#
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 403 |
border:1px solid rgba(0,229,160,0.3);
|
| 404 |
transition:all 0.3s ease;
|
| 405 |
">🎨 Classic Mode</button>
|
| 406 |
+
<a href="/mobile" target="_blank" style="
|
| 407 |
padding:8px 16px; border-radius:8px; cursor:pointer;
|
| 408 |
font-size:12px; font-weight:600; letter-spacing:0.5px;
|
| 409 |
background:rgba(0,180,216,0.15); color:#00b4d8;
|
|
|
|
| 559 |
**Contact:** mmrech@ucs.br | **Version:** 3.0 (ONNX + Glassmorphism)
|
| 560 |
""")
|
| 561 |
|
| 562 |
+
# ===== Custom routes for HTML pages =====
|
| 563 |
+
import fastapi
|
| 564 |
+
from fastapi.responses import HTMLResponse
|
| 565 |
+
|
| 566 |
+
app = fastapi.FastAPI()
|
| 567 |
+
|
| 568 |
+
@app.get("/landing", response_class=HTMLResponse)
|
| 569 |
+
async def landing_page():
|
| 570 |
+
html_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "index.html")
|
| 571 |
+
with open(html_path, "r") as f:
|
| 572 |
+
return HTMLResponse(content=f.read())
|
| 573 |
+
|
| 574 |
+
@app.get("/mobile", response_class=HTMLResponse)
|
| 575 |
+
async def mobile_page():
|
| 576 |
+
html_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "evb_prognosis_mobile.html")
|
| 577 |
+
with open(html_path, "r") as f:
|
| 578 |
+
return HTMLResponse(content=f.read())
|
| 579 |
+
|
| 580 |
+
@app.get("/calculator", response_class=HTMLResponse)
|
| 581 |
+
async def calculator_page():
|
| 582 |
+
html_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "evb_prognosis_complete.html")
|
| 583 |
+
if os.path.exists(html_path):
|
| 584 |
+
with open(html_path, "r") as f:
|
| 585 |
+
return HTMLResponse(content=f.read())
|
| 586 |
+
return HTMLResponse(content="<h1>File not found</h1>", status_code=404)
|
| 587 |
+
|
| 588 |
+
# Mount Gradio app under the FastAPI app
|
| 589 |
+
app = gr.mount_gradio_app(app, demo, path="/")
|
| 590 |
+
|
| 591 |
+
# Serve with uvicorn
|
| 592 |
+
if __name__ == "__main__":
|
| 593 |
+
import uvicorn
|
| 594 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|