Spaces:
Sleeping
Sleeping
Mounting custom UI at /playground
Browse files- server/app.py +8 -12
server/app.py
CHANGED
|
@@ -1,10 +1,8 @@
|
|
| 1 |
"""
|
| 2 |
FastAPI application entry point for the Support Ticket Environment.
|
| 3 |
-
Serves the OpenEnv HTTP/WebSocket API and optionally the Gradio UI at /web.
|
| 4 |
"""
|
| 5 |
import os
|
| 6 |
from openenv.core.env_server.http_server import create_app
|
| 7 |
-
|
| 8 |
from support_ticket_env.models import SupportAction, SupportObservation
|
| 9 |
from support_ticket_env.server.support_environment import SupportTicketEnvironment
|
| 10 |
|
|
@@ -16,13 +14,11 @@ app = create_app(
|
|
| 16 |
max_concurrent_envs=4,
|
| 17 |
)
|
| 18 |
|
| 19 |
-
# Mount Gradio UI at /
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
except Exception as e:
|
| 28 |
-
print(f"Gradio UI not mounted: {e}")
|
|
|
|
| 1 |
"""
|
| 2 |
FastAPI application entry point for the Support Ticket Environment.
|
|
|
|
| 3 |
"""
|
| 4 |
import os
|
| 5 |
from openenv.core.env_server.http_server import create_app
|
|
|
|
| 6 |
from support_ticket_env.models import SupportAction, SupportObservation
|
| 7 |
from support_ticket_env.server.support_environment import SupportTicketEnvironment
|
| 8 |
|
|
|
|
| 14 |
max_concurrent_envs=4,
|
| 15 |
)
|
| 16 |
|
| 17 |
+
# Mount our custom Gradio UI at /playground
|
| 18 |
+
try:
|
| 19 |
+
import gradio as gr
|
| 20 |
+
from support_ticket_env.gradio_ui import demo
|
| 21 |
+
app = gr.mount_gradio_app(app, demo, path="/playground")
|
| 22 |
+
print("Custom Gradio UI mounted at /playground")
|
| 23 |
+
except Exception as e:
|
| 24 |
+
print(f"Gradio UI not mounted: {e}")
|
|
|
|
|
|