Update app.py
Browse files
app.py
CHANGED
|
@@ -640,8 +640,10 @@ def create_gradio_interface(multi_agent_system: MultiAgentSystem, search_client:
|
|
| 640 |
@asynccontextmanager
|
| 641 |
async def lifespan(app: FastAPI):
|
| 642 |
"""์ฑ ์๋ช
์ฃผ๊ธฐ ๊ด๋ฆฌ"""
|
|
|
|
| 643 |
print("\n" + "="*60)
|
| 644 |
print("๐ Multi-Agent RAG System Starting...")
|
|
|
|
| 645 |
print("="*60)
|
| 646 |
yield
|
| 647 |
print("\n๐ Shutting down...")
|
|
@@ -679,12 +681,13 @@ except Exception as e:
|
|
| 679 |
@app.get("/")
|
| 680 |
async def root():
|
| 681 |
"""๋ฃจํธ ์๋ํฌ์ธํธ"""
|
|
|
|
| 682 |
return {
|
| 683 |
"name": "Multi-Agent RAG System",
|
| 684 |
"version": "3.0.0",
|
| 685 |
"status": "running",
|
| 686 |
-
"ui": "http://localhost:
|
| 687 |
-
"docs": "http://localhost:
|
| 688 |
}
|
| 689 |
|
| 690 |
|
|
@@ -776,17 +779,31 @@ if __name__ == "__main__":
|
|
| 776 |
print("\n" + "="*60)
|
| 777 |
print("โ
์์คํ
์ค๋น ์๋ฃ!")
|
| 778 |
print("="*60)
|
| 779 |
-
|
| 780 |
-
|
| 781 |
-
|
| 782 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 783 |
print("\n๐ก Ctrl+C๋ฅผ ๋๋ฌ ์ข
๋ฃ")
|
| 784 |
print("="*60 + "\n")
|
| 785 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 786 |
uvicorn.run(
|
| 787 |
app,
|
| 788 |
-
host=
|
| 789 |
-
port=
|
| 790 |
reload=False,
|
| 791 |
log_level="info"
|
| 792 |
)
|
|
|
|
| 640 |
@asynccontextmanager
|
| 641 |
async def lifespan(app: FastAPI):
|
| 642 |
"""์ฑ ์๋ช
์ฃผ๊ธฐ ๊ด๋ฆฌ"""
|
| 643 |
+
port = int(os.getenv("PORT", 7860))
|
| 644 |
print("\n" + "="*60)
|
| 645 |
print("๐ Multi-Agent RAG System Starting...")
|
| 646 |
+
print(f"๐ Port: {port}")
|
| 647 |
print("="*60)
|
| 648 |
yield
|
| 649 |
print("\n๐ Shutting down...")
|
|
|
|
| 681 |
@app.get("/")
|
| 682 |
async def root():
|
| 683 |
"""๋ฃจํธ ์๋ํฌ์ธํธ"""
|
| 684 |
+
port = int(os.getenv("PORT", 7860))
|
| 685 |
return {
|
| 686 |
"name": "Multi-Agent RAG System",
|
| 687 |
"version": "3.0.0",
|
| 688 |
"status": "running",
|
| 689 |
+
"ui": f"http://localhost:{port}/ui",
|
| 690 |
+
"docs": f"http://localhost:{port}/docs"
|
| 691 |
}
|
| 692 |
|
| 693 |
|
|
|
|
| 779 |
print("\n" + "="*60)
|
| 780 |
print("โ
์์คํ
์ค๋น ์๋ฃ!")
|
| 781 |
print("="*60)
|
| 782 |
+
|
| 783 |
+
# Hugging Face Spaces ํ๊ฒฝ ํ์ธ
|
| 784 |
+
is_hf_spaces = os.getenv("SPACE_ID") is not None
|
| 785 |
+
port = int(os.getenv("PORT", 7860))
|
| 786 |
+
|
| 787 |
+
if is_hf_spaces:
|
| 788 |
+
print("\n๐ค Hugging Face Spaces์์ ์คํ ์ค...")
|
| 789 |
+
print(f" ํฌํธ: {port}")
|
| 790 |
+
else:
|
| 791 |
+
print("\n๐ ์ ์ ์ฃผ์:")
|
| 792 |
+
print(f" ๐จ Gradio UI: http://localhost:{port}/ui")
|
| 793 |
+
print(f" ๐ API Docs: http://localhost:{port}/docs")
|
| 794 |
+
print(f" ๐ง Chat API: POST http://localhost:{port}/api/chat")
|
| 795 |
+
|
| 796 |
print("\n๐ก Ctrl+C๋ฅผ ๋๋ฌ ์ข
๋ฃ")
|
| 797 |
print("="*60 + "\n")
|
| 798 |
|
| 799 |
+
# Hugging Face Spaces ํ๊ฒฝ ๊ฐ์ง
|
| 800 |
+
port = int(os.getenv("PORT", 7860))
|
| 801 |
+
host = "0.0.0.0"
|
| 802 |
+
|
| 803 |
uvicorn.run(
|
| 804 |
app,
|
| 805 |
+
host=host,
|
| 806 |
+
port=port,
|
| 807 |
reload=False,
|
| 808 |
log_level="info"
|
| 809 |
)
|