hy commited on
Commit
64a617e
ยท
1 Parent(s): 37a605f
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. main.py +31 -2
Dockerfile CHANGED
@@ -21,4 +21,4 @@ EXPOSE 7860
21
 
22
  # 8. ์ด ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์ผœ์ง€๋ฉด, ์ž๋™์œผ๋กœ ์ด ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ด ์„œ๋ฒ„ ์ผœ๊ธฐ
23
  # (HFS๋Š” 7860 ํฌํŠธ๋ฅผ ์„ ํ˜ธํ•ฉ๋‹ˆ๋‹ค)
24
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--root-path", "/", "--forwarded-allow-ips", "*"]
 
21
 
22
  # 8. ์ด ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์ผœ์ง€๋ฉด, ์ž๋™์œผ๋กœ ์ด ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ด ์„œ๋ฒ„ ์ผœ๊ธฐ
23
  # (HFS๋Š” 7860 ํฌํŠธ๋ฅผ ์„ ํ˜ธํ•ฉ๋‹ˆ๋‹ค)
24
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
main.py CHANGED
@@ -34,7 +34,7 @@ class AnalysisResponse(BaseModel):
34
  breakdown: Dict[str, ScoreBreakdown]
35
 
36
  # --- 2. FastAPI ์•ฑ ์ƒ์„ฑ ---
37
- app = FastAPI(root_path="", docs_url="/docs", redoc_url="/redoc")
38
 
39
  # --- 3. API ์—”๋“œํฌ์ธํŠธ ---
40
 
@@ -109,4 +109,33 @@ def analyze_article(request: ArticleRequest):
109
 
110
  @app.get("/")
111
  def read_root():
112
- return {"message": "AI ๊ธฐ์‚ฌ ๋ถ„์„ ์„œ๋ฒ„ v1.0 (Dummy Server)"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  breakdown: Dict[str, ScoreBreakdown]
35
 
36
  # --- 2. FastAPI ์•ฑ ์ƒ์„ฑ ---
37
+ app = FastAPI(docs_url=None, redoc_url=None)
38
 
39
  # --- 3. API ์—”๋“œํฌ์ธํŠธ ---
40
 
 
109
 
110
  @app.get("/")
111
  def read_root():
112
+ return {"message": "AI ๊ธฐ์‚ฌ ๋ถ„์„ ์„œ๋ฒ„ v1.0 (Dummy Server)"}
113
+ # -------------------------------------------------------------------
114
+ # ๋ช…์„ธ์„œ ๊ธฐ๋Šฅ ์ˆ˜๋™ ๋งˆ์šดํŠธ (์ด ์ฝ”๋“œ๋ฅผ main.py์˜ ๊ฐ€์žฅ ์•„๋ž˜์— ์ถ”๊ฐ€)
115
+ # -------------------------------------------------------------------
116
+
117
+ # 1. ๋ช…์„ธ์„œ์˜ ์›๋ณธ ๋ฐ์ดํ„ฐ(JSON)๋ฅผ ์ œ๊ณตํ•˜๋Š” ์—”๋“œํฌ์ธํŠธ
118
+ @app.get("/openapi.json", include_in_schema=False)
119
+ async def get_open_api_endpoint():
120
+ return get_openapi(
121
+ title=app.title,
122
+ version=app.version,
123
+ description=app.description,
124
+ routes=app.routes,
125
+ )
126
+
127
+ # 2. /docs (Swagger UI) ์—”๋“œํฌ์ธํŠธ ์ˆ˜๋™ ์ •์˜
128
+ @app.get("/docs", include_in_schema=False)
129
+ async def get_documentation():
130
+ return get_swagger_ui_html(
131
+ openapi_url="/openapi.json",
132
+ title=app.title + " - Swagger UI"
133
+ )
134
+
135
+ # 3. /redoc ์—”๋“œํฌ์ธํŠธ ์ˆ˜๋™ ์ •์˜
136
+ @app.get("/redoc", include_in_schema=False)
137
+ async def get_redoc_documentation():
138
+ return get_redoc_html(
139
+ openapi_url="/openapi.json",
140
+ title=app.title + " - ReDoc"
141
+ )