ElPlaguister commited on
Commit
0533c1e
1 Parent(s): 2d411cc

Fix app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -36,21 +36,23 @@ def prepare_theme():
36
  )
37
  return theme
38
 
39
- def chat(message, chat_history, model):
 
40
  response = model.chat(message)
41
  chat_history.append((message, response))
42
  return "", chat_history
43
 
44
- theme = prepare_theme()
45
- model = T5()
 
46
 
47
- with gr.Blocks(theme=theme) as demo:
48
- with gr.Row():
49
- with gr.Column(scale=5): # 챗봇 부분
50
- chatbot = gr.Chatbot(label="T5", bubble_full_width=False)
51
- with gr.Row():
52
- txt = gr.Textbox(show_label=False, placeholder='Send a message...', container=False)
53
 
54
- txt.submit(chat, [txt, chatbot, model], [txt, chatbot])
55
 
56
- demo.launch(debug=True, share=True)
 
36
  )
37
  return theme
38
 
39
+ def chat(message, chat_history):
40
+ global model
41
  response = model.chat(message)
42
  chat_history.append((message, response))
43
  return "", chat_history
44
 
45
+ if __name__=='__main__':
46
+ theme = prepare_theme()
47
+ model = T5()
48
 
49
+ with gr.Blocks(theme=theme) as demo:
50
+ with gr.Row():
51
+ with gr.Column(scale=5): # 챗봇 부분
52
+ chatbot = gr.Chatbot(label="T5", bubble_full_width=False)
53
+ with gr.Row():
54
+ txt = gr.Textbox(show_label=False, placeholder='Send a message...', container=False)
55
 
56
+ txt.submit(chat, [txt, chatbot], [txt, chatbot])
57
 
58
+ demo.launch(debug=True, share=True)