Spaces:
Sleeping
Sleeping
Update
Browse files
src/inference_server/__pycache__/simple_integrated.cpython-312.pyc
CHANGED
Binary files a/src/inference_server/__pycache__/simple_integrated.cpython-312.pyc and b/src/inference_server/__pycache__/simple_integrated.cpython-312.pyc differ
|
|
src/inference_server/simple_integrated.py
CHANGED
@@ -4,7 +4,6 @@ import time
|
|
4 |
|
5 |
import gradio as gr
|
6 |
import uvicorn
|
7 |
-
from fastapi import FastAPI
|
8 |
from fastapi.middleware.cors import CORSMiddleware
|
9 |
|
10 |
# Import our existing components
|
@@ -200,6 +199,7 @@ def create_simple_gradio_interface() -> gr.Blocks:
|
|
200 |
title="🤖 Robot AI Control Center",
|
201 |
theme=gr.themes.Soft(),
|
202 |
css=".gradio-container { max-width: 1200px !important; }",
|
|
|
203 |
) as demo:
|
204 |
gr.Markdown("""
|
205 |
# 🤖 Robot AI Control Center
|
@@ -327,36 +327,6 @@ def create_simple_gradio_interface() -> gr.Blocks:
|
|
327 |
return demo
|
328 |
|
329 |
|
330 |
-
def create_integrated_app() -> FastAPI:
|
331 |
-
"""Create integrated FastAPI app with Gradio mounted and API at /api."""
|
332 |
-
# Create main FastAPI app
|
333 |
-
main_app = FastAPI(
|
334 |
-
title="🤖 Robot AI Control Center",
|
335 |
-
description="Integrated ACT Model Inference Server with Web Interface",
|
336 |
-
version="1.0.0",
|
337 |
-
)
|
338 |
-
|
339 |
-
# Add CORS middleware
|
340 |
-
main_app.add_middleware(
|
341 |
-
CORSMiddleware,
|
342 |
-
allow_origins=["*"],
|
343 |
-
allow_credentials=True,
|
344 |
-
allow_methods=["*"],
|
345 |
-
allow_headers=["*"],
|
346 |
-
)
|
347 |
-
|
348 |
-
# Mount the FastAPI AI server under /api
|
349 |
-
main_app.mount("/api", fastapi_app)
|
350 |
-
|
351 |
-
# Create and mount Gradio interface
|
352 |
-
gradio_app = create_simple_gradio_interface()
|
353 |
-
|
354 |
-
# Mount Gradio as the main interface
|
355 |
-
main_app = gr.mount_gradio_app(main_app, gradio_app, path="/")
|
356 |
-
|
357 |
-
return main_app
|
358 |
-
|
359 |
-
|
360 |
def launch_simple_integrated_app(
|
361 |
host: str = "localhost", port: int = DEFAULT_PORT, share: bool = False
|
362 |
):
|
@@ -367,15 +337,33 @@ def launch_simple_integrated_app(
|
|
367 |
print(f"🔄 Health Check: http://{host}:{port}/api/health")
|
368 |
print("🔧 Direct session management + API access!")
|
369 |
|
370 |
-
# Create
|
371 |
-
|
|
|
|
|
|
|
372 |
|
373 |
-
#
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
)
|
380 |
|
381 |
|
|
|
4 |
|
5 |
import gradio as gr
|
6 |
import uvicorn
|
|
|
7 |
from fastapi.middleware.cors import CORSMiddleware
|
8 |
|
9 |
# Import our existing components
|
|
|
199 |
title="🤖 Robot AI Control Center",
|
200 |
theme=gr.themes.Soft(),
|
201 |
css=".gradio-container { max-width: 1200px !important; }",
|
202 |
+
fill_height=True,
|
203 |
) as demo:
|
204 |
gr.Markdown("""
|
205 |
# 🤖 Robot AI Control Center
|
|
|
327 |
return demo
|
328 |
|
329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
def launch_simple_integrated_app(
|
331 |
host: str = "localhost", port: int = DEFAULT_PORT, share: bool = False
|
332 |
):
|
|
|
337 |
print(f"🔄 Health Check: http://{host}:{port}/api/health")
|
338 |
print("🔧 Direct session management + API access!")
|
339 |
|
340 |
+
# Create Gradio demo
|
341 |
+
demo = create_simple_gradio_interface()
|
342 |
+
|
343 |
+
# Create custom FastAPI app from the Gradio demo's built-in app
|
344 |
+
app = demo.app
|
345 |
|
346 |
+
# Add CORS middleware
|
347 |
+
app.add_middleware(
|
348 |
+
CORSMiddleware,
|
349 |
+
allow_origins=["*"],
|
350 |
+
allow_credentials=True,
|
351 |
+
allow_methods=["*"],
|
352 |
+
allow_headers=["*"],
|
353 |
+
)
|
354 |
+
|
355 |
+
# Mount the FastAPI AI server under /api
|
356 |
+
app.mount("/api", fastapi_app)
|
357 |
+
|
358 |
+
# Launch using Gradio's queue and launch methods
|
359 |
+
demo.queue()
|
360 |
+
demo.launch(
|
361 |
+
server_name=host,
|
362 |
+
server_port=port,
|
363 |
+
share=share,
|
364 |
+
show_error=True,
|
365 |
+
show_api=False, # Hide Gradio's default API docs since we have our own
|
366 |
+
prevent_thread_lock=False,
|
367 |
)
|
368 |
|
369 |
|