alwaysgood commited on
Commit
eb94029
·
verified ·
1 Parent(s): e430143

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -62,17 +62,24 @@ def compare_stations(station_ids: List[str], target_time: Optional[str] = None):
62
  return api_compare_stations(station_ids, target_time)
63
 
64
 
65
- # 3. 기존의 Gradio UI 생성합니다.
66
- # create_ui 함수는 그대로 사용됩니다.
67
  warnings.filterwarnings('ignore')
68
  demo = create_ui(
69
  prediction_handler=single_prediction,
70
  chatbot_handler=process_chatbot_query_with_llm
71
  )
72
 
73
- # 4. FastAPI 앱에 Gradio UI 마운트(연결)합니다.
74
- # path="/"는 기본 주소로 접속했을 때 Gradio UI가 보이도록 설정합니다.
75
  app = gr.mount_gradio_app(app, demo, path="/")
76
 
77
- # 참고: 이제 demo.launch()는 사용하지 않습니다.
78
- # Hugging Face Spaces는 'app'이라는 이름의 FastAPI 객체를 자동으로 찾아 실행해 줍니다.
 
 
 
 
 
 
 
 
 
 
62
  return api_compare_stations(station_ids, target_time)
63
 
64
 
65
+ # --- Gradio UI 생성 ---
 
66
  warnings.filterwarnings('ignore')
67
  demo = create_ui(
68
  prediction_handler=single_prediction,
69
  chatbot_handler=process_chatbot_query_with_llm
70
  )
71
 
72
+ # --- FastAPI 앱에 Gradio UI 마운트 ---
 
73
  app = gr.mount_gradio_app(app, demo, path="/")
74
 
75
+
76
+ # --- 로컬에서 직접 실행할 때를 위한 실행 블록 ---
77
+ if __name__ == "__main__":
78
+ print("로컬 개발 서버를 시작합니다. http://127.0.0.1:7860 에서 확인하세요.")
79
+ # uvicorn.run()을 사용하여 FastAPI 앱을 실행합니다.
80
+ # 이렇게 하면 'python app.py' 명령어로도 로컬 테스트가 가능해집니다.
81
+ uvicorn.run(
82
+ app,
83
+ host="0.0.0.0",
84
+ port=7860
85
+ )