ThongAccount commited on
Commit
917d560
·
1 Parent(s): a132611
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -57,13 +57,20 @@ def respond(
57
 
58
  return answer_vi
59
 
60
- # Quan trọng: bật api_open=True ngay lúc tạo
61
- demo = gr.ChatInterface(
62
  fn=respond,
63
  title="🤖 Trợ lý AI Tiếng Việt (Translate-then-Predict)",
64
  description="💬 Nhập tiếng Việt ➔ dịch tiếng Anh ➔ hỏi model ➔ dịch lại tiếng Việt.",
65
- theme="soft"
66
  )
67
 
 
 
 
 
 
 
 
68
  if __name__ == "__main__":
69
- demo.launch(share=False)
 
57
 
58
  return answer_vi
59
 
60
+ # Tạo ChatInterface
61
+ chat = gr.ChatInterface(
62
  fn=respond,
63
  title="🤖 Trợ lý AI Tiếng Việt (Translate-then-Predict)",
64
  description="💬 Nhập tiếng Việt ➔ dịch tiếng Anh ➔ hỏi model ➔ dịch lại tiếng Việt.",
65
+ theme="soft",
66
  )
67
 
68
+ # Gói nó trong gr.Blocks
69
+ with gr.Blocks() as demo:
70
+ chat.render()
71
+
72
+ # ⚡ Bật OpenAPI để Huggingface Spaces nhận diện được API
73
+ demo.openapi = True
74
+
75
  if __name__ == "__main__":
76
+ demo.launch()