Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -81,7 +81,8 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
|
| 81 |
chatbot2up = [None,languagedict['English']['interviewquestionsfirst']]
|
| 82 |
state2up = [{"role": "system", "content": themeinterviewquestions},{"role": "assistant", "content": languagedict[language]['interviewquestionsfirst']}]
|
| 83 |
chatbot3up = [None,languagedict['English']['whatcanidofirst']]
|
| 84 |
-
|
|
|
|
| 85 |
return titleup, input1up, input2up, input3up, chatbot1up, chatbot2up, chatbot3up, state1up, state2up, state3up
|
| 86 |
|
| 87 |
languageoptions = ["English", "廣東話"]
|
|
@@ -147,6 +148,19 @@ After the candidate answered, write:
|
|
| 147 |
|
| 148 |
Then ask another question.
|
| 149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
IMPORTANT: write in {language}, in the style of a native inhabitant from Kowloon
|
| 151 |
"""
|
| 152 |
|
|
@@ -162,26 +176,14 @@ IMPORTANT: write in {language}, in the style of a native inhabitant from Kowloon
|
|
| 162 |
with gr.Tab(f"{languagedict['English']['help']} / {languagedict['廣東話']['help']}"):
|
| 163 |
chatbot3 = gr.Chatbot([[None,languagedict['English']['helpfirst']]])
|
| 164 |
input3 = gr.Textbox(label = languagedict['English']['helplabel'])
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
|
|
|
| 169 |
clear = gr.Button('Clear')
|
| 170 |
|
| 171 |
-
themehelp = f"""
|
| 172 |
-
You are a social worker, you need to provide some help to the user. He can ask questions relative to:
|
| 173 |
-
- care support for children or elderly in Hong Kong
|
| 174 |
-
- health
|
| 175 |
-
- housing
|
| 176 |
-
- food
|
| 177 |
-
- work
|
| 178 |
-
- leisure
|
| 179 |
-
To answer, use primarily the information indicated here:
|
| 180 |
-
{instructions}
|
| 181 |
-
If the question is not related to any of these topics, answer 'This is beyond my domain of competence, please ask a social worker.'
|
| 182 |
|
| 183 |
-
IMPORTANT: write in {language}, in the style of a native inhabitant from Kowloon
|
| 184 |
-
"""
|
| 185 |
|
| 186 |
# Launcher
|
| 187 |
input1.submit(refreshmode1, mode, mode).then(user, [input1, chatbot1, state1], [input1, chatbot1, state1]).then(bot, [chatbot1, state1, mode], [chatbot1, state1])
|
|
|
|
| 81 |
chatbot2up = [None,languagedict['English']['interviewquestionsfirst']]
|
| 82 |
state2up = [{"role": "system", "content": themeinterviewquestions},{"role": "assistant", "content": languagedict[language]['interviewquestionsfirst']}]
|
| 83 |
chatbot3up = [None,languagedict['English']['whatcanidofirst']]
|
| 84 |
+
complement = f"To answer, use primarily the information indicated here:\n{instructions}"
|
| 85 |
+
state3up = [{"role": "system", "content": themehelp + f"\n{complement}"},{"role": "assistant", "content": languagedict[language]['helpfirst']}]
|
| 86 |
return titleup, input1up, input2up, input3up, chatbot1up, chatbot2up, chatbot3up, state1up, state2up, state3up
|
| 87 |
|
| 88 |
languageoptions = ["English", "廣東話"]
|
|
|
|
| 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 |
|
|
|
|
| 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 |
|
|
|
|
|
|
|
| 187 |
|
| 188 |
# Launcher
|
| 189 |
input1.submit(refreshmode1, mode, mode).then(user, [input1, chatbot1, state1], [input1, chatbot1, state1]).then(bot, [chatbot1, state1, mode], [chatbot1, state1])
|