Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
-
from fastapi import FastAPI
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
| 3 |
from api import api_router
|
| 4 |
import gradio as gr
|
| 5 |
import requests
|
|
@@ -27,6 +28,12 @@ def root():
|
|
| 27 |
logger.debug("Root endpoint accessed")
|
| 28 |
return {"message": "π FastAPI with MongoDB + JWT is running."}
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
# Gradio doctor creation logic
|
| 31 |
BACKEND_URL = "https://rocketfarmstudios-cps-api.hf.space"
|
| 32 |
|
|
@@ -65,7 +72,7 @@ def setup_gradio():
|
|
| 65 |
.output-box textarea { background-color: transparent !important; border: none; color: #90CDF4; font-size: 14px; margin-top: 1rem; }
|
| 66 |
""") as admin_ui:
|
| 67 |
gr.Markdown("<div class='title-text'>π¨ββοΈ Doctor Account Creator</div>")
|
| 68 |
-
gr.Markdown("<div class='description-text'>Admins can register new doctors using this secure panel. Generated at 03:
|
| 69 |
|
| 70 |
with gr.Column():
|
| 71 |
full_name = gr.Textbox(label="Full Name", placeholder="e.g. Dr. Sarah Hopkins")
|
|
@@ -87,11 +94,11 @@ def setup_gradio():
|
|
| 87 |
)
|
| 88 |
return admin_ui
|
| 89 |
|
| 90 |
-
# Mount Gradio at /admin
|
| 91 |
if __name__ == "__main__":
|
| 92 |
logger.debug("Running main block")
|
| 93 |
admin_ui = setup_gradio()
|
| 94 |
app = gr.mount_gradio_app(app, admin_ui, path="/admin")
|
| 95 |
logger.debug("Gradio mounted, starting app")
|
| 96 |
import uvicorn
|
| 97 |
-
uvicorn.run(app, host="0.0.0.0", port=
|
|
|
|
| 1 |
+
from fastapi import FastAPI, Request
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
+
from fastapi.responses import RedirectResponse
|
| 4 |
from api import api_router
|
| 5 |
import gradio as gr
|
| 6 |
import requests
|
|
|
|
| 28 |
logger.debug("Root endpoint accessed")
|
| 29 |
return {"message": "π FastAPI with MongoDB + JWT is running."}
|
| 30 |
|
| 31 |
+
# Redirect /login to /auth/login
|
| 32 |
+
@app.post("/login")
|
| 33 |
+
async def redirect_login(request: Request):
|
| 34 |
+
logger.info("Redirecting /login to /auth/login")
|
| 35 |
+
return RedirectResponse(url="/auth/login", status_code=307)
|
| 36 |
+
|
| 37 |
# Gradio doctor creation logic
|
| 38 |
BACKEND_URL = "https://rocketfarmstudios-cps-api.hf.space"
|
| 39 |
|
|
|
|
| 72 |
.output-box textarea { background-color: transparent !important; border: none; color: #90CDF4; font-size: 14px; margin-top: 1rem; }
|
| 73 |
""") as admin_ui:
|
| 74 |
gr.Markdown("<div class='title-text'>π¨ββοΈ Doctor Account Creator</div>")
|
| 75 |
+
gr.Markdown("<div class='description-text'>Admins can register new doctors using this secure panel. Generated at 03:43 PM CET on Saturday, May 17, 2025.</div>")
|
| 76 |
|
| 77 |
with gr.Column():
|
| 78 |
full_name = gr.Textbox(label="Full Name", placeholder="e.g. Dr. Sarah Hopkins")
|
|
|
|
| 94 |
)
|
| 95 |
return admin_ui
|
| 96 |
|
| 97 |
+
# Mount Gradio at /admin
|
| 98 |
if __name__ == "__main__":
|
| 99 |
logger.debug("Running main block")
|
| 100 |
admin_ui = setup_gradio()
|
| 101 |
app = gr.mount_gradio_app(app, admin_ui, path="/admin")
|
| 102 |
logger.debug("Gradio mounted, starting app")
|
| 103 |
import uvicorn
|
| 104 |
+
uvicorn.run(app, host="0.0.0.0", port=7860) # Hugging Face Spaces default port
|