Guiyom commited on
Commit
5de2187
·
1 Parent(s): 0d52f67

Update app.py

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