| | |
| | from modal import Image, Stub, asgi_app |
| | import sys |
| |
|
| | |
| | image = Image.debian_slim().pip_install_from_requirements("requirements.txt") |
| |
|
| | |
| | stub = Stub("code-review-agent") |
| |
|
| | @stub.function(image=image, timeout=600) |
| | @asgi_app() |
| | def app(): |
| | """ |
| | Deploy the Code Review Agent as an ASGI app on Modal. |
| | |
| | This function sets up the Gradio application and returns it as an ASGI app |
| | that Modal can serve. The app will be accessible via a URL provided by Modal |
| | after deployment. |
| | |
| | Returns: |
| | ASGI application: The Gradio app as an ASGI application |
| | """ |
| | import os |
| | import sys |
| | import logging |
| | from dotenv import load_dotenv |
| |
|
| | |
| | sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) |
| |
|
| | |
| | from src.ui.gradio_app import create_gradio_app |
| | from src.core.agent_manager import AgentManager |
| |
|
| | |
| | logging.basicConfig( |
| | level=logging.INFO, |
| | format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' |
| | ) |
| |
|
| | |
| | load_dotenv() |
| | |
| | |
| | logs_dir = os.path.join(os.path.dirname(__file__), 'logs') |
| | os.makedirs(logs_dir, exist_ok=True) |
| |
|
| | |
| | agent_manager = AgentManager() |
| |
|
| | |
| | gradio_app = create_gradio_app(agent_manager) |
| | |
| | |
| | return gradio_app.app |
| |
|
| |
|
| | if __name__ == "__main__": |
| | |
| | stub.serve() |
| | |
| | |
| | |