Emperor555 Claude commited on
Commit
6272921
·
1 Parent(s): 8cb9b81

Use web_server for Gradio deployment on Modal

Browse files

More reliable than asgi_app for Gradio apps.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. modal_app.py +7 -9
modal_app.py CHANGED
@@ -31,17 +31,15 @@ image = (
31
  modal.Secret.from_name("elevenlabs-api-key"),
32
  ],
33
  timeout=600,
 
34
  )
35
- @modal.concurrent(max_inputs=100)
36
- @modal.asgi_app()
37
  def serve():
38
- """Serve the Gradio app as ASGI."""
39
- import sys
40
- sys.path.insert(0, "/app")
41
-
42
- from app import create_app
43
- gradio_app = create_app()
44
- return gradio_app
45
 
46
 
47
  # For local testing
 
31
  modal.Secret.from_name("elevenlabs-api-key"),
32
  ],
33
  timeout=600,
34
+ container_idle_timeout=300,
35
  )
36
+ @modal.web_server(port=7860, startup_timeout=120)
 
37
  def serve():
38
+ """Serve the Gradio app via web_server."""
39
+ import subprocess
40
+ import os
41
+ os.chdir("/app")
42
+ subprocess.Popen(["python", "app.py"])
 
 
43
 
44
 
45
  # For local testing