Guiyom commited on
Commit
6294bfb
·
1 Parent(s): ed72fea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -13
app.py CHANGED
@@ -75,9 +75,9 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
75
 
76
  def refresh(language: str):
77
  titleup = gr.update(value = languagedict[language]['welcome'])
78
- input1up = gr.update(label = languagedict[language]['whatcanidolabel'])
79
- input2up = gr.update(label = languagedict[language]['interviewquestionslabel'])
80
- input3up = gr.update(label = languagedict[language]['helplabel'])
81
  chatbot1up = [[None,languagedict[language]['whatcanidofirst']]]
82
  state1up = [{"role": "system", "content": themewhatcanido},{"role": "assistant", "content": languagedict[language]['whatcanidofirst']}]
83
  chatbot2up = [[None,languagedict[language]['interviewquestionsfirst']]]
@@ -94,24 +94,30 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
94
  "whatcanido": "What job can I do?",
95
  "whatcanidofirst" : "Tell me about you.",
96
  "whatcanidolabel": "Write your preferences and we can suggest some options",
 
97
  "interviewquestions": "How to prepare for interview?",
98
  "interviewquestionsfirst": "What is the role you're interviewing for?",
99
  "interviewquestionslabel": "Answer the questions for this virtual interview",
 
100
  "help": "Where to get help?",
101
  "helpfirst": "How can I help you?",
102
- "helplabel": "Where do you need help? Here's is what we can suggest"
 
103
  },
104
  "廣東話": {
105
  "welcome": "歡迎使用 Make It Work App - 借助人工智能,您可以獲得量身定制的幫助",
106
  "whatcanido": "我可以做什麼工作?",
107
  "whatcanidofirst" : "介紹一下你自己吧。",
108
  "whatcanidolabel": "寫下您的喜好,我們可以建議一些選擇",
 
109
  "interviewquestions": "如何準備面試?",
110
  "interviewquestionsfirst": "你面試的角色是什麼?",
111
  "interviewquestionslabel": "回答這位 AI 面試官的問題",
 
112
  "help": "去哪裡尋求幫助?",
113
  "helpfirst": "我怎麼幫你",
114
- "helplabel": "你在哪裡需要幫助?我們會讓您知道如何找到它"
 
115
  }
116
  }
117
 
@@ -120,10 +126,11 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
120
  # INTERFACE
121
  mode = gr.Textbox(value = "mode1", visible = False)
122
  with gr.Row():
 
 
123
  with gr.Column(scale = 3):
124
  title = gr.Markdown(value=languagedict['English']['welcome'])
125
- with gr.Accordion("Language/語言", open = False):
126
- language = gr.Dropdown(languageoptions , value= "English", label="Choose language / 選擇語言")
127
 
128
  # REFERENCES
129
 
@@ -171,15 +178,15 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
171
  #INTERFACE
172
  with gr.Tab(f"{languagedict['English']['whatcanido']} / {languagedict['廣東話']['whatcanido']}"):
173
  chatbot1 = gr.Chatbot([[None,languagedict['English']['whatcanidofirst']]])
174
- input1 = gr.Textbox(label = languagedict['English']['whatcanidolabel'])
175
  state1 = gr.State([{"role": "system", "content": themewhatcanido},{"role": "assistant", "content": languagedict['English']['whatcanidofirst']}])
176
  with gr.Tab(f"{languagedict['English']['interviewquestions']} / {languagedict['廣東話']['interviewquestions']}"):
177
  chatbot2 = gr.Chatbot([[None,languagedict['English']['interviewquestionsfirst']]])
178
- input2 = gr.Textbox(label = languagedict['English']['interviewquestionslabel'])
179
  state2 = gr.State([{"role": "system", "content": themeinterviewquestions},{"role": "assistant", "content": languagedict['English']['interviewquestionsfirst']}])
180
  with gr.Tab(f"{languagedict['English']['help']} / {languagedict['廣東話']['help']}"):
181
  chatbot3 = gr.Chatbot([[None,languagedict['English']['helpfirst']]])
182
- input3 = gr.Textbox(label = languagedict['English']['helplabel'])
183
  with gr.Accordion("MIW", open = False):
184
  code = gr.Textbox(label = 'Code')
185
  instructions = gr.Textbox(label = 'Instructions', lines=10, max_lines= 100, visible = False)
@@ -187,9 +194,6 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
187
  state3 = gr.State([{"role": "system", "content": themehelp + f"\n{complement}"},{"role": "assistant", "content": languagedict['English']['helpfirst']}])
188
  clear = gr.Button('Clear')
189
 
190
- with gr.Column(scale = 1):
191
- visual = gr.Image(value = url, shape = [150,150])
192
-
193
  # Launcher
194
  input1.submit(refreshmode1, mode, mode).then(user, [input1, chatbot1, state1, language, mode], [input1, chatbot1, state1]).then(bot, [chatbot1, state1], [chatbot1, state1])
195
  input2.submit(refreshmode2, mode, mode).then(user, [input2, chatbot2, state2, language, mode], [input2, chatbot2, state2]).then(bot, [chatbot2, state2], [chatbot2, state2])
 
75
 
76
  def refresh(language: str):
77
  titleup = gr.update(value = languagedict[language]['welcome'])
78
+ input1up = gr.update(label = languagedict[language]['whatcanidolabel'], placeholder = languagedict[language]['whatcanidoph'])
79
+ input2up = gr.update(label = languagedict[language]['interviewquestionslabel'], placeholder = languagedict[language]['interviewquestionsph'])
80
+ input3up = gr.update(label = languagedict[language]['helplabel'], placeholder = languagedict[language]['helpph'])
81
  chatbot1up = [[None,languagedict[language]['whatcanidofirst']]]
82
  state1up = [{"role": "system", "content": themewhatcanido},{"role": "assistant", "content": languagedict[language]['whatcanidofirst']}]
83
  chatbot2up = [[None,languagedict[language]['interviewquestionsfirst']]]
 
94
  "whatcanido": "What job can I do?",
95
  "whatcanidofirst" : "Tell me about you.",
96
  "whatcanidolabel": "Write your preferences and we can suggest some options",
97
+ "whatcanidoph": "I'm a 30 years old single mother, I have a 6 years old daughter. I can cook, take care of children and elderly and have been a waiter at a restaurant before.\nI have a high school degree.",
98
  "interviewquestions": "How to prepare for interview?",
99
  "interviewquestionsfirst": "What is the role you're interviewing for?",
100
  "interviewquestionslabel": "Answer the questions for this virtual interview",
101
+ "interviewquestionsph": "I want to prepare for an interview as a receptionist.",
102
  "help": "Where to get help?",
103
  "helpfirst": "How can I help you?",
104
+ "helplabel": "Where do you need help? Here's is what we can suggest",
105
+ "helpph": "How can I have support to take care of my daughter during my work? / How can I get trained on Excel?"
106
  },
107
  "廣東話": {
108
  "welcome": "歡迎使用 Make It Work App - 借助人工智能,您可以獲得量身定制的幫助",
109
  "whatcanido": "我可以做什麼工作?",
110
  "whatcanidofirst" : "介紹一下你自己吧。",
111
  "whatcanidolabel": "寫下您的喜好,我們可以建議一些選擇",
112
+ "whatcanidoph": "我是一個 30 歲的單身母親,我有一個 6 歲的女兒。我會做飯,照顧孩子和老人,以前在餐廳當過服務員。\n我有高中學歷。",
113
  "interviewquestions": "如何準備面試?",
114
  "interviewquestionsfirst": "你面試的角色是什麼?",
115
  "interviewquestionslabel": "回答這位 AI 面試官的問題",
116
+ "interviewquestionsph": "我想以接待員的身份準備面試。",
117
  "help": "去哪裡尋求幫助?",
118
  "helpfirst": "我怎麼幫你",
119
+ "helplabel": "你在哪裡需要幫助?我們會讓您知道如何找到它",
120
+ "helpph": "我如何在工作期間獲得支持來照顧我的女兒? / 我怎樣才能接受 Excel 培訓?"
121
  }
122
  }
123
 
 
126
  # INTERFACE
127
  mode = gr.Textbox(value = "mode1", visible = False)
128
  with gr.Row():
129
+ with gr.Column(scale = 1):
130
+ visual = gr.Image(value = url, shape = [150,150])
131
  with gr.Column(scale = 3):
132
  title = gr.Markdown(value=languagedict['English']['welcome'])
133
+ language = gr.Dropdown(languageoptions , value= "English", label="Choose language / 選擇語言")
 
134
 
135
  # REFERENCES
136
 
 
178
  #INTERFACE
179
  with gr.Tab(f"{languagedict['English']['whatcanido']} / {languagedict['廣東話']['whatcanido']}"):
180
  chatbot1 = gr.Chatbot([[None,languagedict['English']['whatcanidofirst']]])
181
+ input1 = gr.Textbox(label = languagedict['English']['whatcanidolabel'], placeholder = languagedict['English']['whatcanidoph'])
182
  state1 = gr.State([{"role": "system", "content": themewhatcanido},{"role": "assistant", "content": languagedict['English']['whatcanidofirst']}])
183
  with gr.Tab(f"{languagedict['English']['interviewquestions']} / {languagedict['廣東話']['interviewquestions']}"):
184
  chatbot2 = gr.Chatbot([[None,languagedict['English']['interviewquestionsfirst']]])
185
+ input2 = gr.Textbox(label = languagedict['English']['interviewquestionslabel'], placeholder = languagedict['English']['interviewquestionsph'])
186
  state2 = gr.State([{"role": "system", "content": themeinterviewquestions},{"role": "assistant", "content": languagedict['English']['interviewquestionsfirst']}])
187
  with gr.Tab(f"{languagedict['English']['help']} / {languagedict['廣東話']['help']}"):
188
  chatbot3 = gr.Chatbot([[None,languagedict['English']['helpfirst']]])
189
+ input3 = gr.Textbox(label = languagedict['English']['helplabel'], placeholder = languagedict['English']['helpph'])
190
  with gr.Accordion("MIW", open = False):
191
  code = gr.Textbox(label = 'Code')
192
  instructions = gr.Textbox(label = 'Instructions', lines=10, max_lines= 100, visible = False)
 
194
  state3 = gr.State([{"role": "system", "content": themehelp + f"\n{complement}"},{"role": "assistant", "content": languagedict['English']['helpfirst']}])
195
  clear = gr.Button('Clear')
196
 
 
 
 
197
  # Launcher
198
  input1.submit(refreshmode1, mode, mode).then(user, [input1, chatbot1, state1, language, mode], [input1, chatbot1, state1]).then(bot, [chatbot1, state1], [chatbot1, state1])
199
  input2.submit(refreshmode2, mode, mode).then(user, [input2, chatbot2, state2, language, mode], [input2, chatbot2, state2]).then(bot, [chatbot2, state2], [chatbot2, state2])