File size: 1,210 Bytes
b5df735
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""
Modal mode deployment script
Sets environment variables and deploys the application to Modal
"""

import os
import sys
import subprocess

def main():
    """Deploy application to Modal"""
    
    print("☁️ Deploying Gradio MCP Server to MODAL")
    print("πŸš€ GPU functions will run locally on Modal")
    
    # Set deployment mode to modal
    os.environ["DEPLOYMENT_MODE"] = "modal"
    
    try:
        # Deploy to Modal using modal deploy command
        print("πŸš€ Deploying to Modal...")
        result = subprocess.run([
            "modal", "deploy", "src.app::gradio_mcp_app"
        ], check=True, capture_output=True, text=True)
        
        print("βœ… Successfully deployed to Modal!")
        print("Output:", result.stdout)
        
    except subprocess.CalledProcessError as e:
        print(f"❌ Modal deployment failed: {e}")
        print("Error output:", e.stderr)
        sys.exit(1)
    except FileNotFoundError:
        print("❌ Modal CLI not found. Please install it with: pip install modal")
        sys.exit(1)
    except Exception as e:
        print(f"❌ Unexpected error: {e}")
        sys.exit(1)

if __name__ == "__main__":
    main()