ElPlaguister commited on
Commit
bbc20a6
โ€ข
1 Parent(s): 4db1eca

Feat Different Placeholder Each Model

Browse files
Files changed (2) hide show
  1. app.py +10 -11
  2. model.py +3 -1
app.py CHANGED
@@ -52,20 +52,19 @@ if __name__=='__main__':
52
  readme = f.read()
53
 
54
  MODELS.append(T5())
 
55
  if not LOCAL_TEST:
56
  MODELS.append(KoAlpaca())
 
57
 
58
  with gr.Blocks(theme=prepare_theme()) as demo:
59
- with gr.Column():
60
- gr.HTML("<h1>KOMUChat</h1>")
61
- with gr.Tab("์†Œ๊ฐœ"):
62
- gr.Markdown(readme)
63
- for i in range(len(MODELS)):
64
- with gr.Tab(MODEL_STRS[i], id=i):
65
- with gr.Column():
66
- chatbot = gr.Chatbot(label=MODEL_STRS[i], bubble_full_width=False)
67
- txt = gr.Textbox(show_label=False, placeholder='์—ฐ์•  ๊ด€๋ จ ์งˆ๋ฌธ์„ ์ž…๋ ฅํ•˜์„ธ์š”!', container=False, elem_id=i)
68
-
69
- txt.submit(MODELS[i].chat, [txt, chatbot], [txt, chatbot])
70
 
71
  demo.launch(debug=True, share=True)
 
52
  readme = f.read()
53
 
54
  MODELS.append(T5())
55
+ MODELS[0].placeholder = '์—ฐ์•  ๊ด€๋ จ ์งˆ๋ฌธ์„ ์ž…๋ ฅํ•˜์„ธ์š”!'
56
  if not LOCAL_TEST:
57
  MODELS.append(KoAlpaca())
58
+ MODELS[1].placeholder = '์—ฐ์•  ๊ด€๋ จ ์งˆ๋ฌธ์„ ์ž…๋ ฅํ•˜์„ธ์š”. (KoAlpaca๋Š” ์ถ”๋ก  ์‹œ 1๋ถ„ ์ด์ƒ ์†Œ์š”๋ฉ๋‹ˆ๋‹ค!)'
59
 
60
  with gr.Blocks(theme=prepare_theme()) as demo:
61
+ gr.HTML("<h1>KOMUChat : Korean community-style relationship counseling chabot</h1>")
62
+ with gr.Tab("์†Œ๊ฐœ"):
63
+ gr.Markdown(readme)
64
+ for i in range(len(MODELS)):
65
+ with gr.Tab(MODEL_STRS[i]):
66
+ chatbot = gr.Chatbot(label=MODEL_STRS[i], bubble_full_width=False)
67
+ txt = gr.Textbox(show_label=False, placeholder=MODELS[i].placeholder, container=False, elem_id=i)
68
+ txt.submit(MODELS[i].chat, [txt, chatbot], [txt, chatbot])
 
 
 
69
 
70
  demo.launch(debug=True, share=True)
model.py CHANGED
@@ -1,8 +1,10 @@
1
  import gradio as gr
2
  class Model:
3
  def __init__(self,
4
- name:str="Model"):
 
5
  self.name = name
 
6
  self.model = None
7
  self.tokenizer = None
8
  self.gen_config = None
 
1
  import gradio as gr
2
  class Model:
3
  def __init__(self,
4
+ name:str="Model",
5
+ placeholder:str="Input"):
6
  self.name = name
7
+ self.placeholder = placeholder
8
  self.model = None
9
  self.tokenizer = None
10
  self.gen_config = None