Guiyom commited on
Commit
d6112d1
·
1 Parent(s): a809418

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +66 -63
app.py CHANGED
@@ -117,71 +117,74 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
117
 
118
  # INTERFACE
119
  mode = gr.Textbox(value = "mode1", visible = False)
120
- title = gr.Markdown(value=languagedict['English']['welcome'])
121
- visual = gr.Image(value = url, shape = [150,150])
122
- language = gr.Dropdown(languageoptions , value= "English", label="Choose language / 選擇語言")
 
 
123
 
124
- # REFERENCES
125
-
126
- themewhatcanido = f"""
127
- You are a career advisor for people in Hong Kong with relatively low skills job.
128
- Your mission is to ask several questions to then help them identify what are their job options, taking into consideration:
129
- - Their study level and domain
130
- - Their level of confort with computer tools (typing, excel, word, ...)
131
- - Their past working experiences (ex: hair dresser, street cleaner, old care support, restaurant aide, waiter)
132
- - Their constraints (ex: time available per week, per day)
133
- - Other relevant questions
134
-
135
- Then, when you have enough information, you will thank them and suggest some options, for each of them:
136
- - Explain the key skills needed
137
- - Breakdown the potential challenges for them to anticipate
138
- - Provide advice on how to overcome these challenges
139
-
140
- IMPORTANT: write in {language}, in the style of a native inhabitant from Kowloon
141
- """
142
 
143
- themeinterviewquestions = f"""
144
- You are an interviewer, interviewing a candidate for a role [the role will be specified to you].
145
- Your candidates have limited skills, please find ways to support them and ask all the questions.
146
- After the candidate answered, write:
147
- [IDEAL ANSWER] then reformulate the candidate answer to match what would be an ideal response
148
-
149
- Then ask another question.
150
-
151
- IMPORTANT: write in {language}, in the style of a native inhabitant from Kowloon
152
- """
153
-
154
- themehelp = f"""
155
- You are a social worker, you need to provide some help to the user. He can ask questions relative to:
156
- - care support for children or elderly in Hong Kong
157
- - health
158
- - housing
159
- - food
160
- - work
161
- - leisure
162
- If the question is not related to any of these topics, answer 'This is beyond my domain of competence, please ask a social worker.'
163
-
164
- IMPORTANT: write in {language}, in the style of a native inhabitant from Kowloon
165
- """
166
-
167
- #INTERFACE
168
- with gr.Tab(f"{languagedict['English']['whatcanido']} / {languagedict['廣東話']['whatcanido']}"):
169
- chatbot1 = gr.Chatbot([[None,languagedict['English']['whatcanidofirst']]])
170
- input1 = gr.Textbox(label = languagedict['English']['whatcanidolabel'])
171
- state1 = gr.State([{"role": "system", "content": themewhatcanido},{"role": "assistant", "content": languagedict['English']['whatcanidofirst']}])
172
- with gr.Tab(f"{languagedict['English']['interviewquestions']} / {languagedict['廣東話']['interviewquestions']}"):
173
- chatbot2 = gr.Chatbot([[None,languagedict['English']['interviewquestionsfirst']]])
174
- input2 = gr.Textbox(label = languagedict['English']['interviewquestionslabel'])
175
- state2 = gr.State([{"role": "system", "content": themeinterviewquestions},{"role": "assistant", "content": languagedict['English']['interviewquestionsfirst']}])
176
- with gr.Tab(f"{languagedict['English']['help']} / {languagedict['廣東話']['help']}"):
177
- chatbot3 = gr.Chatbot([[None,languagedict['English']['helpfirst']]])
178
- input3 = gr.Textbox(label = languagedict['English']['helplabel'])
179
- with gr.Accordion("MIW", open = False):
180
- code = gr.Textbox(label = 'Code')
181
- instructions = gr.Textbox(label = 'Instructions', lines=10, max_lines= 100, visible = False)
182
- complement = f"To answer, use primarily the information indicated here:\n{instructions}"
183
- state3 = gr.State([{"role": "system", "content": themehelp + f"\n{complement}"},{"role": "assistant", "content": languagedict['English']['helpfirst']}])
184
- clear = gr.Button('Clear')
 
 
 
 
 
 
 
 
 
 
 
185
 
186
  # Launcher
187
  input1.submit(refreshmode1, mode, mode).then(user, [input1, chatbot1, state1], [input1, chatbot1, state1]).then(bot, [chatbot1, state1, mode], [chatbot1, state1])
 
117
 
118
  # INTERFACE
119
  mode = gr.Textbox(value = "mode1", visible = False)
120
+ gr.Column(scale = 3:
121
+ title = gr.Markdown(value=languagedict['English']['welcome'])
122
+ language = gr.Dropdown(languageoptions , value= "English", label="Choose language / 選擇語言")
123
+
124
+ # REFERENCES
125
 
126
+ themewhatcanido = f"""
127
+ You are a career advisor for people in Hong Kong with relatively low skills job.
128
+ Your mission is to ask several questions to then help them identify what are their job options, taking into consideration:
129
+ - Their study level and domain
130
+ - Their level of confort with computer tools (typing, excel, word, ...)
131
+ - Their past working experiences (ex: hair dresser, street cleaner, old care support, restaurant aide, waiter)
132
+ - Their constraints (ex: time available per week, per day)
133
+ - Other relevant questions
 
 
 
 
 
 
 
 
 
 
134
 
135
+ Then, when you have enough information, you will thank them and suggest some options, for each of them:
136
+ - Explain the key skills needed
137
+ - Breakdown the potential challenges for them to anticipate
138
+ - Provide advice on how to overcome these challenges
139
+
140
+ IMPORTANT: write in {language}, in the style of a native inhabitant from Kowloon
141
+ """
142
+
143
+ themeinterviewquestions = f"""
144
+ You are an interviewer, interviewing a candidate for a role [the role will be specified to you].
145
+ Your candidates have limited skills, please find ways to support them and ask all the questions.
146
+ After the candidate answered, write:
147
+ [IDEAL ANSWER] then reformulate the candidate answer to match what would be an ideal response
148
+
149
+ Then ask another question.
150
+
151
+ IMPORTANT: write in {language}, in the style of a native inhabitant from Kowloon
152
+ """
153
+
154
+ themehelp = f"""
155
+ You are a social worker, you need to provide some help to the user. He can ask questions relative to:
156
+ - care support for children or elderly in Hong Kong
157
+ - health
158
+ - housing
159
+ - food
160
+ - work
161
+ - leisure
162
+ If the question is not related to any of these topics, answer 'This is beyond my domain of competence, please ask a social worker.'
163
+
164
+ IMPORTANT: write in {language}, in the style of a native inhabitant from Kowloon
165
+ """
166
+
167
+ #INTERFACE
168
+ with gr.Tab(f"{languagedict['English']['whatcanido']} / {languagedict['廣東話']['whatcanido']}"):
169
+ chatbot1 = gr.Chatbot([[None,languagedict['English']['whatcanidofirst']]])
170
+ input1 = gr.Textbox(label = languagedict['English']['whatcanidolabel'])
171
+ state1 = gr.State([{"role": "system", "content": themewhatcanido},{"role": "assistant", "content": languagedict['English']['whatcanidofirst']}])
172
+ with gr.Tab(f"{languagedict['English']['interviewquestions']} / {languagedict['廣東話']['interviewquestions']}"):
173
+ chatbot2 = gr.Chatbot([[None,languagedict['English']['interviewquestionsfirst']]])
174
+ input2 = gr.Textbox(label = languagedict['English']['interviewquestionslabel'])
175
+ state2 = gr.State([{"role": "system", "content": themeinterviewquestions},{"role": "assistant", "content": languagedict['English']['interviewquestionsfirst']}])
176
+ with gr.Tab(f"{languagedict['English']['help']} / {languagedict['廣東話']['help']}"):
177
+ chatbot3 = gr.Chatbot([[None,languagedict['English']['helpfirst']]])
178
+ input3 = gr.Textbox(label = languagedict['English']['helplabel'])
179
+ with gr.Accordion("MIW", open = False):
180
+ code = gr.Textbox(label = 'Code')
181
+ instructions = gr.Textbox(label = 'Instructions', lines=10, max_lines= 100, visible = False)
182
+ complement = f"To answer, use primarily the information indicated here:\n{instructions}"
183
+ state3 = gr.State([{"role": "system", "content": themehelp + f"\n{complement}"},{"role": "assistant", "content": languagedict['English']['helpfirst']}])
184
+ clear = gr.Button('Clear')
185
+
186
+ gr.Column(scale = 1):
187
+ visual = gr.Image(value = url, shape = [150,150])
188
 
189
  # Launcher
190
  input1.submit(refreshmode1, mode, mode).then(user, [input1, chatbot1, state1], [input1, chatbot1, state1]).then(bot, [chatbot1, state1, mode], [chatbot1, state1])