Spaces:
Sleeping
Sleeping
| """ | |
| Combined App for MedLLaMA2 Medical Chatbot | |
| This file runs both the Gradio interface and Flask API server | |
| """ | |
| import threading | |
| import time | |
| import subprocess | |
| import sys | |
| import os | |
| def run_gradio(): | |
| """Run the Gradio app""" | |
| subprocess.run([sys.executable, "app.py"]) | |
| def run_api(): | |
| """Run the API server""" | |
| # Wait a bit for the model to load in Gradio | |
| time.sleep(10) | |
| subprocess.run([sys.executable, "api_server.py"]) | |
| if __name__ == "__main__": | |
| print("π Starting MedLLaMA2 Combined Server...") | |
| print("π This will start both Gradio UI (port 7860) and API server (port 8000)") | |
| # Create threads for both servers | |
| gradio_thread = threading.Thread(target=run_gradio) | |
| api_thread = threading.Thread(target=run_api) | |
| # Start both threads | |
| gradio_thread.start() | |
| api_thread.start() | |
| # Wait for both to complete | |
| gradio_thread.join() | |
| api_thread.join() | |