Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import os
|
|
| 2 |
import json
|
| 3 |
import gradio as gr
|
| 4 |
from typing import List, Tuple
|
|
|
|
| 5 |
|
| 6 |
# グローバル最小依存で起動 → 実処理は遅延 import
|
| 7 |
def _lazy_imports_for_main():
|
|
@@ -105,6 +106,12 @@ with gr.Blocks(title="営業自動化 Agent Studio", theme=gr.themes.Soft()) as
|
|
| 105 |
outputs=[score_json, contexts_text, proposal_md, docx_file, pptx_file, next_actions, index_report],
|
| 106 |
)
|
| 107 |
|
| 108 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
if __name__ == "__main__":
|
| 110 |
-
|
|
|
|
|
|
| 2 |
import json
|
| 3 |
import gradio as gr
|
| 4 |
from typing import List, Tuple
|
| 5 |
+
from fastapi import FastAPI # ★ 追加
|
| 6 |
|
| 7 |
# グローバル最小依存で起動 → 実処理は遅延 import
|
| 8 |
def _lazy_imports_for_main():
|
|
|
|
| 106 |
outputs=[score_json, contexts_text, proposal_md, docx_file, pptx_file, next_actions, index_report],
|
| 107 |
)
|
| 108 |
|
| 109 |
+
# ====== ★ ここが重要:FastAPI に Gradio をマウントして ASGI 変数 app を公開 ======
|
| 110 |
+
app = FastAPI()
|
| 111 |
+
# キューを使う場合は .queue() をマウント
|
| 112 |
+
app = gr.mount_gradio_app(app, demo.queue(), path="/")
|
| 113 |
+
|
| 114 |
+
# ローカル起動用のおまけ(Spaces では uvicorn app:app が使われる)
|
| 115 |
if __name__ == "__main__":
|
| 116 |
+
import uvicorn
|
| 117 |
+
uvicorn.run(app, host="0.0.0.0", port=int(os.getenv("PORT", "7860")))
|