File size: 3,365 Bytes
52510e8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | import os
import sys
import subprocess
import time
import webbrowser
def print_banner():
banner = """
======================================================================
βββββ βββ ββ ββββββββ ββ ββββββ ββββββ βββββ ββ ββ ββ
ββ ββ ββββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ
βββββββ ββ ββ ββ ββ ββ ββ βββ ββββββ βββββββ ββββ ββ
ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ
ββ ββ ββ ββββ ββ ββ ββββββ ββ ββ ββ ββ ββ ββ
======================================================================
INTELLIGENT LLM HUB - DISTRIBUTED TRANSFORMER FRAMEWORK
======================================================================
* Loaded with: Hugging Face Weights Bridge (Bi-directional)
* Feature suite: Autoregressive Streaming Inference & Live Sampler
* Training suite: Fine-tuning console + Dynamic Loss Chart
* Destination Hub: Host & upload directly to profile 'Aravindhan11'
======================================================================
"""
print(banner)
def main():
print_banner()
# Check if inside directory
current_dir = os.path.dirname(os.path.abspath(__file__))
server_path = os.path.join(current_dir, "server.py")
if not os.path.exists(server_path):
print(f"Error: Could not locate server.py in {current_dir}. Please run from the root directory.")
sys.exit(1)
print("Checking dependencies...")
try:
import torch
import transformers
import datasets
print("-> Core dependencies (PyTorch, Transformers, Datasets) verified successfully.")
except ImportError as e:
print(f"Error: Missing core dependency. Please run 'uv sync' or install manually:\n pip install torch transformers datasets rich")
sys.exit(1)
port = 8000
print(f"\nStarting API Server on port {port}...")
# Start server.py in a subprocess
# Using sys.executable to ensure we use the same Python interpreter
try:
process = subprocess.Popen(
[sys.executable, server_path, str(port)],
cwd=current_dir
)
# Give the server a second to boot up
time.sleep(2)
# Open web browser
url = f"http://localhost:{port}"
print(f"\n-> Launching your Web Dashboard at: {url}")
print("-> Press Ctrl+C in this terminal to stop the server and close the dashboard.")
webbrowser.open(url)
# Wait for the subprocess to finish
process.wait()
except KeyboardInterrupt:
print("\n\nShutting down Intelligent Framework Hub...")
try:
process.terminate()
process.wait(timeout=3)
except Exception:
pass
print("Server stopped. Goodbye!")
except Exception as e:
print(f"Error running the command center: {e}")
if __name__ == "__main__":
main()
|