cmulgy commited on
Commit
787c60a
Β·
1 Parent(s): 41b743c
Files changed (4) hide show
  1. .gitignore +62 -0
  2. app.py +60 -0
  3. try_zijie_0627.py β†’ demo.py +0 -0
  4. requirements.txt +32 -0
.gitignore ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+ MANIFEST
23
+
24
+ # Environment variables
25
+ .env
26
+ .env.local
27
+ .env.*.local
28
+
29
+ # IDE
30
+ .vscode/
31
+ .idea/
32
+ *.swp
33
+ *.swo
34
+ *~
35
+
36
+ # OS
37
+ .DS_Store
38
+ .DS_Store?
39
+ ._*
40
+ .Spotlight-V100
41
+ .Trashes
42
+ ehthumbs.db
43
+ Thumbs.db
44
+
45
+ # Jupyter Notebook
46
+ .ipynb_checkpoints
47
+
48
+ # PyTorch
49
+ *.pth
50
+ *.pt
51
+ *.ckpt
52
+
53
+ # Logs
54
+ *.log
55
+ logs/
56
+
57
+ # Temporary files
58
+ *.tmp
59
+ *.temp
60
+
61
+ # Hugging Face Spaces specific
62
+ .cache/
app.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ RoutePilot - GNN-LLM Intelligent Selection System
3
+ Hugging Face Spaces Entry Point
4
+
5
+ This is the main entry point for the Hugging Face Spaces deployment.
6
+ It imports the necessary components from the existing application and
7
+ sets up the Gradio interface for deployment.
8
+ """
9
+
10
+ import os
11
+ import sys
12
+ import gradio as gr
13
+
14
+ # Add the current directory to Python path for imports
15
+ sys.path.append(os.path.dirname(__file__))
16
+
17
+ # Import the main application components
18
+ from demo import create_interface
19
+
20
+ # Set up environment variables for Hugging Face Spaces
21
+ def setup_environment():
22
+ """Set up environment variables for Hugging Face Spaces deployment"""
23
+ # Check if we're running on Hugging Face Spaces
24
+ if os.getenv("SPACE_ID"):
25
+ print("πŸš€ Running on Hugging Face Spaces")
26
+
27
+ # Set default values for required environment variables
28
+ if not os.getenv("NVIDIA_API_KEY"):
29
+ print("⚠️ NVIDIA_API_KEY not set. Some features may be limited.")
30
+ print(" Please set NVIDIA_API_KEY in the Space settings.")
31
+
32
+ # Set CUDA device for Spaces (usually limited resources)
33
+ os.environ["CUDA_VISIBLE_DEVICES"] = "0"
34
+
35
+ # Set memory optimization flags
36
+ os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "max_split_size_mb:128"
37
+
38
+ else:
39
+ print("🏠 Running locally")
40
+
41
+ def main():
42
+ """Main function to launch the application"""
43
+ # Set up environment
44
+ setup_environment()
45
+
46
+ # Create the Gradio interface
47
+ print("🎯 Creating RoutePilot interface...")
48
+ demo = create_interface()
49
+
50
+ # Launch the application
51
+ # For Hugging Face Spaces, we don't need to specify server_name and port
52
+ # The platform handles this automatically
53
+ demo.launch(
54
+ show_error=True,
55
+ debug=False, # Set to False for production
56
+ show_api=False
57
+ )
58
+
59
+ if __name__ == "__main__":
60
+ main()
try_zijie_0627.py β†’ demo.py RENAMED
File without changes
requirements.txt ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Core ML and Deep Learning
2
+ torch>=2.1.0
3
+ torch-geometric>=2.4.0
4
+ transformers>=4.49.0
5
+ sentence-transformers>=2.2.2
6
+
7
+ # Data Processing
8
+ numpy>=2.2.3
9
+ pandas>=2.2.3
10
+ scikit-learn>=1.6.1
11
+ scipy>=1.15.2
12
+
13
+ # Web Interface
14
+ gradio>=5.34.2
15
+
16
+ # API and HTTP
17
+ requests>=2.31.0
18
+ openai>=1.0.0
19
+
20
+ # Utilities
21
+ tqdm>=4.67.1
22
+ PyYAML>=6.0
23
+ python-dotenv>=1.0.0
24
+
25
+ # Datasets
26
+ datasets>=3.3.2
27
+
28
+ # LLM Integration
29
+ litellm>=1.52.10
30
+
31
+ # Additional dependencies for Hugging Face Spaces
32
+ accelerate>=0.20.0