|
|
|
""" |
|
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") |
|
|
|
|
|
os.environ["DEPLOYMENT_MODE"] = "modal" |
|
|
|
try: |
|
|
|
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() |