-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_python_backend.py
More file actions
46 lines (40 loc) · 1.36 KB
/
Copy pathrun_python_backend.py
File metadata and controls
46 lines (40 loc) · 1.36 KB
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Startup script for The Linguist Python Backend
"""
import os
import sys
import subprocess
from pathlib import Path
def main():
# check if we're in the correct directory
if not Path("backend").exists():
print("❌ Error: backend directory not found")
print("Please run this script from the project root directory")
sys.exit(1)
# check if requirements are installed
try:
import fastapi
import groq
import uvicorn
print("✅ Dependencies are installed")
except ImportError as e:
print(f"❌ Missing dependency: {e}")
print("Please install dependencies:")
print("Check Readme.md for instructions")
sys.exit(1)
# start the server
print("🚀 Starting The Linguist Python Backend...")
print("📡 Server will be available at: http://localhost:8000")
print("📚 API docs will be available at: http://localhost:8000/docs")
print("🌍 Health check: http://localhost:8000/health")
print("💡 Users will enter their Groq API keys through the web interface")
print("\nPress Ctrl+C to stop the server\n")
try:
# run the server
os.system("python3 -m backend.server")
except KeyboardInterrupt:
print("\n🛑 Server stopped")
if __name__ == "__main__":
main()