young476 commited on
Commit
1d4f7d5
Β·
1 Parent(s): b8356c0

Edit app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -61,13 +61,12 @@ demo = gr.Interface(
61
  # api_name="predict" # λͺ…μ‹œμ μœΌλ‘œ API 이름을 μ„€μ •ν•˜λ©΄ /api/predict μ—”λ“œν¬μΈνŠΈκ°€ ν™•μ‹€νžˆ μƒμ„±λ©λ‹ˆλ‹€.
62
  )
63
 
 
64
  if __name__ == "__main__":
65
- print("Launching Gradio app...")
66
- # API 접근을 μœ„ν•΄μ„œλŠ” queue()λ₯Ό μ‚¬μš©ν•˜κ³  server_name을 μ„€μ •ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.
67
- # server_name="0.0.0.0"은 Docker μ»¨ν…Œμ΄λ„ˆ μ™ΈλΆ€(예: 호슀트의 Next.js)μ—μ„œ μ ‘κ·Ό ν—ˆμš©
68
- # server_port=7860은 Gradio κΈ°λ³Έ 포트
69
- # queue() μ‚¬μš© μ‹œ api_open=Trueκ°€ 기본값인 κ²½μš°κ°€ λ§Žμ•„ /api/predict μ—”λ“œν¬μΈνŠΈκ°€ ν™œμ„±ν™”λ  κ°€λŠ₯성이 λ†’μŒ
70
  demo.queue().launch(server_name="0.0.0.0", server_port=7860)
71
- # λ˜λŠ”, queue() 없이 api_name을 λͺ…μ‹œ:
72
- # demo.launch(server_name="0.0.0.0", server_port=7860, api_name="predict")
73
- print(f"Gradio app launched. Access UI at http://localhost:7860. API (likely) at http://localhost:7860/api/predict")
 
61
  # api_name="predict" # λͺ…μ‹œμ μœΌλ‘œ API 이름을 μ„€μ •ν•˜λ©΄ /api/predict μ—”λ“œν¬μΈνŠΈκ°€ ν™•μ‹€νžˆ μƒμ„±λ©λ‹ˆλ‹€.
62
  )
63
 
64
+ # ... (이전 λ‹΅λ³€μ˜ μˆ˜μ •λœ app.py μ½”λ“œ 전체) ...
65
  if __name__ == "__main__":
66
+ print("Launching Gradio app with queue and explicit API exposure...")
67
+ # queue() μ‚¬μš© μ‹œ /api/predict κ°€ κΈ°λ³Έ μ—”λ“œν¬μΈνŠΈμΌ κ°€λŠ₯성이 λ†’μŒ
68
+ # λ˜λŠ” api_name을 λͺ…μ‹œμ μœΌλ‘œ μ„€μ •:
 
 
69
  demo.queue().launch(server_name="0.0.0.0", server_port=7860)
70
+ # demo.launch(server_name="0.0.0.0", server_port=7860, api_name="predict") # μ΄λ ‡κ²Œ 해도 됨
71
+ print(f"Gradio app should be accessible at http://localhost:7860")
72
+ print(f"Try API endpoint for Next.js: http://localhost:7860/api/predict (or as defined by api_name)")