RobotHub-InferenceServer / launch_simple.py
blanchon's picture
Update
63ed3a7
raw
history blame
1.52 kB
#!/usr/bin/env python3
"""
Main launcher for the Inference Server
Integrated application that runs both FastAPI and Gradio on the same port.
- FastAPI API available at /api with full documentation
- Gradio UI available at the root path /
- Single process, single port - perfect for deployment!
"""
import sys
from pathlib import Path
# Add the src directory to Python path
src_path = Path(__file__).parent / "src"
sys.path.insert(0, str(src_path))
from inference_server.simple_integrated import launch_simple_integrated_app
if __name__ == "__main__":
print("๐Ÿค– Inference Server (Integrated)")
print("FastAPI + Gradio on the same port!")
print("API Documentation available at /api/docs")
print("Press Ctrl+C to stop")
print("-" * 50)
# Parse simple command line args
import argparse
parser = argparse.ArgumentParser(
description="Launch integrated Inference Server with FastAPI + Gradio"
)
parser.add_argument("--host", default="localhost", help="Host to bind to")
parser.add_argument("--port", type=int, default=7860, help="Port to bind to")
parser.add_argument(
"--share", action="store_true", help="Create public Gradio link"
)
args = parser.parse_args()
print(f"๐Ÿš€ Starting on {args.host}:{args.port}")
print(f"๐ŸŽจ Gradio UI: http://{args.host}:{args.port}/")
print(f"๐Ÿ“– API Docs: http://{args.host}:{args.port}/api/docs")
print()
launch_simple_integrated_app(host=args.host, port=args.port, share=args.share)