Spaces:
Sleeping
Sleeping
MekkCyber
commited on
Commit
·
eca64a5
1
Parent(s):
740d91a
update
Browse files
app.py
CHANGED
@@ -138,11 +138,21 @@ def interface():
|
|
138 |
|
139 |
demo = interface()
|
140 |
|
141 |
-
# Access FastAPI app instance from Gradio
|
142 |
-
fastapi_app = demo.app
|
143 |
|
144 |
-
# Add SessionMiddleware to enable session management
|
145 |
-
fastapi_app.add_middleware(SessionMiddleware, secret_key="secret_key") # Use a secure, random secret key
|
146 |
|
147 |
-
# Launch the app
|
148 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
demo = interface()
|
140 |
|
141 |
+
# # Access FastAPI app instance from Gradio
|
142 |
+
# fastapi_app = demo.app
|
143 |
|
144 |
+
# # Add SessionMiddleware to enable session management
|
145 |
+
# fastapi_app.add_middleware(SessionMiddleware, secret_key="secret_key") # Use a secure, random secret key
|
146 |
|
147 |
+
# # Launch the app
|
148 |
+
# demo.launch()
|
149 |
+
|
150 |
+
from fastapi import FastAPI
|
151 |
+
|
152 |
+
app = FastAPI()
|
153 |
+
|
154 |
+
# Add SessionMiddleware for sessions handling
|
155 |
+
app.add_middleware(SessionMiddleware, secret_key="secure_secret_key")
|
156 |
+
|
157 |
+
# Mount Gradio app to FastAPI at the root
|
158 |
+
app.mount("/", demo)
|