Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,28 +37,23 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
|
| 37 |
|
| 38 |
# INTERFACE
|
| 39 |
title = gr.Markdown(value=languagedict['English']['welcome'])
|
| 40 |
-
language = gr.Dropdown(languageoptions , value= "English")
|
| 41 |
-
with gr.Tab(languagedict['English']['whatcanido']):
|
| 42 |
chatbot1 = gr.Chatbot()
|
| 43 |
input1 = gr.Textbox(label = languagedict['English']['whatcanidolabel'])
|
| 44 |
state1 = gr.State([])
|
| 45 |
-
with gr.Tab(languagedict['English']['
|
| 46 |
chatbot2 = gr.Chatbot()
|
| 47 |
-
input2 = gr.Textbox(label = languagedict['English']['
|
| 48 |
state2 = gr.State([])
|
| 49 |
-
with gr.Tab(languagedict['English']['
|
| 50 |
chatbot3 = gr.Chatbot()
|
| 51 |
-
input3 = gr.Textbox(label = languagedict['English']['
|
| 52 |
state3 = gr.State([])
|
| 53 |
-
with gr.Tab(languagedict['English']['help']):
|
| 54 |
-
chatbot4 = gr.Chatbot()
|
| 55 |
-
input4 = gr.Textbox(label = languagedict['English']['helplabel'])
|
| 56 |
-
state4 = gr.State([])
|
| 57 |
with gr.Tab("MIW"):
|
| 58 |
code = gr.Textbox(label = 'Code')
|
| 59 |
instructions = gr.Textbox(label = 'Instructions', lines=10, max_lines= 100, visible = False)
|
| 60 |
clear = gr.Button('Clear')
|
| 61 |
-
|
| 62 |
themewhatcanido = f"""
|
| 63 |
You are a career advisor for people in Hong Kong with relatively low skills job.
|
| 64 |
Your mission is to ask several questions to then help them identify what are their job options, taking into consideration:
|
|
@@ -152,16 +147,22 @@ IMPORTANT: write in {language}, in the style of a native inhabitant from Kowloon
|
|
| 152 |
state += {'role':'assistant','content':'response'}
|
| 153 |
return chatbot, state
|
| 154 |
|
| 155 |
-
def
|
| 156 |
-
|
| 157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
-
def help(input3)
|
| 160 |
-
|
| 161 |
# Launcher
|
| 162 |
input1.submit(user, [input1, chatbot1, state1], [input1, chatbot1, state1]).then(bot, [chatbot1, state1, "mode1"], [chatbot1, state1])
|
| 163 |
input2.submit(user, [input2, chatbot2, state2], [input2, chatbot2, state2]).then(bot, [chatbot2, state2, "mode2"], [chatbot2, state2])
|
| 164 |
input3.submit(user, [input3, chatbot3, state3], [input3, chatbot3, state3]).then(bot, [chatbot3, state3, "mode3"], [chatbot3, state3])
|
| 165 |
clear.click(lambda: None, None, [chatbot1, chatbot2, chatbot3], queue=True).success(init_history, [state1, state2, state3], [state1, state2, state3])
|
|
|
|
|
|
|
| 166 |
demo.queue()
|
| 167 |
demo.launch()
|
|
|
|
| 37 |
|
| 38 |
# INTERFACE
|
| 39 |
title = gr.Markdown(value=languagedict['English']['welcome'])
|
| 40 |
+
language = gr.Dropdown(languageoptions , value= "English", label="Choose language / 選擇語言")
|
| 41 |
+
with tab1 = gr.Tab(languagedict['English']['whatcanido']):
|
| 42 |
chatbot1 = gr.Chatbot()
|
| 43 |
input1 = gr.Textbox(label = languagedict['English']['whatcanidolabel'])
|
| 44 |
state1 = gr.State([])
|
| 45 |
+
with tab2 = gr.Tab(languagedict['English']['interviewquestions']):
|
| 46 |
chatbot2 = gr.Chatbot()
|
| 47 |
+
input2 = gr.Textbox(label = languagedict['English']['interviewquestionslabel'])
|
| 48 |
state2 = gr.State([])
|
| 49 |
+
with tab3 = gr.Tab(languagedict['English']['help']):
|
| 50 |
chatbot3 = gr.Chatbot()
|
| 51 |
+
input3 = gr.Textbox(label = languagedict['English']['helplabel'])
|
| 52 |
state3 = gr.State([])
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
with gr.Tab("MIW"):
|
| 54 |
code = gr.Textbox(label = 'Code')
|
| 55 |
instructions = gr.Textbox(label = 'Instructions', lines=10, max_lines= 100, visible = False)
|
| 56 |
clear = gr.Button('Clear')
|
|
|
|
| 57 |
themewhatcanido = f"""
|
| 58 |
You are a career advisor for people in Hong Kong with relatively low skills job.
|
| 59 |
Your mission is to ask several questions to then help them identify what are their job options, taking into consideration:
|
|
|
|
| 147 |
state += {'role':'assistant','content':'response'}
|
| 148 |
return chatbot, state
|
| 149 |
|
| 150 |
+
def refresh(language):
|
| 151 |
+
titleup = gr.update(value = languagedict[language]['welcome'])
|
| 152 |
+
tab1up = gr.update(value = languagedict[language]['whatcanido'])
|
| 153 |
+
tab2up = gr.update(value = languagedict[language]['interviewquestions'])
|
| 154 |
+
tab3up = gr.update(value = languagedict[language]['help'])
|
| 155 |
+
input1up = gr.update(value = languagedict[language]['whatcanidolabel'])
|
| 156 |
+
input2up = gr.update(value = languagedict[language]['interviewquestionslabel'])
|
| 157 |
+
input3up = gr.update(value = languagedict[language]['helplabel'])
|
| 158 |
+
return titleup, tab1up, tab2up, tab3up, input1up, input2up, input3up
|
| 159 |
|
|
|
|
|
|
|
| 160 |
# Launcher
|
| 161 |
input1.submit(user, [input1, chatbot1, state1], [input1, chatbot1, state1]).then(bot, [chatbot1, state1, "mode1"], [chatbot1, state1])
|
| 162 |
input2.submit(user, [input2, chatbot2, state2], [input2, chatbot2, state2]).then(bot, [chatbot2, state2, "mode2"], [chatbot2, state2])
|
| 163 |
input3.submit(user, [input3, chatbot3, state3], [input3, chatbot3, state3]).then(bot, [chatbot3, state3, "mode3"], [chatbot3, state3])
|
| 164 |
clear.click(lambda: None, None, [chatbot1, chatbot2, chatbot3], queue=True).success(init_history, [state1, state2, state3], [state1, state2, state3])
|
| 165 |
+
language.change(refresh, language, [title, tab1, tab2, tab3, input1, input2, input3])
|
| 166 |
+
|
| 167 |
demo.queue()
|
| 168 |
demo.launch()
|