Update app.py
Browse files
app.py
CHANGED
@@ -198,7 +198,7 @@ def generate(prompt, history):
|
|
198 |
yield output
|
199 |
|
200 |
|
201 |
-
def
|
202 |
global Name, Occupation,Ethnicity,Gender,Age,chat_log_name,YearsOfExp
|
203 |
print(reset_button)
|
204 |
Name = name
|
@@ -240,37 +240,32 @@ def reset_all():
|
|
240 |
unique_id = generate_unique_id()
|
241 |
return f"All Chat components have been rest. Uniqe ID for this session is, {unique_id}. Please note this down."
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
)
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
gr.
|
253 |
-
gr.Textbox(label="
|
254 |
-
gr.
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
gr.
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
)
|
263 |
-
|
264 |
-
|
265 |
-
with gr.
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
btn = gr.Button("Reset ChatBot Instance")
|
270 |
-
btn.click(fn=reset_all, inputs=None, outputs=out)
|
271 |
-
|
272 |
-
|
273 |
-
tabs = gr.TabbedInterface([name_interface, chat_bot,reset_section], ["User Info", "Chat Bot","Reset Chatbot"])
|
274 |
|
275 |
if __name__ == "__main__":
|
276 |
-
|
|
|
198 |
yield output
|
199 |
|
200 |
|
201 |
+
def submit_user_info(name,occupation,yearsofexp,ethnicity,gender,age,reset_button):
|
202 |
global Name, Occupation,Ethnicity,Gender,Age,chat_log_name,YearsOfExp
|
203 |
print(reset_button)
|
204 |
Name = name
|
|
|
240 |
unique_id = generate_unique_id()
|
241 |
return f"All Chat components have been rest. Uniqe ID for this session is, {unique_id}. Please note this down."
|
242 |
|
243 |
+
with gr.Blocks() as app:
|
244 |
+
gr.Markdown("# ECU-IVADE: Enhanced Conversational UI for Virtual Assistance and Dialogue Engagement")
|
245 |
+
unique_id_display = gr.Textbox(value=unique_id, label="Session Unique ID", interactive=False)
|
246 |
+
|
247 |
+
with gr.Tab("User Info"):
|
248 |
+
name = gr.Textbox(label="Name")
|
249 |
+
occupation = gr.Textbox(label="Occupation")
|
250 |
+
yearsofexp = gr.Textbox(label="Years of Experience")
|
251 |
+
ethnicity = gr.Textbox(label="Ethnicity")
|
252 |
+
gender = gr.Dropdown(choices=["Male", "Female", "Other", "Prefer Not To Say"], label="Gender")
|
253 |
+
age = gr.Textbox(label="Age")
|
254 |
+
submit_info = gr.Button("Submit")
|
255 |
+
submit_info.click(submit_user_info, inputs=[name, occupation, yearsofexp, ethnicity, gender, age], outputs=None)
|
256 |
+
|
257 |
+
with gr.Tab("Chat Bot"):
|
258 |
+
chatbot = gr.Chatbot()
|
259 |
+
msg = gr.Textbox(label="Type your message")
|
260 |
+
send = gr.Button("Send")
|
261 |
+
clear = gr.Button("Clear Chat")
|
262 |
+
send.click(generate, inputs=[msg], outputs=chatbot)
|
263 |
+
clear.click(lambda: chatbot.clear(), inputs=[], outputs=chatbot)
|
264 |
+
|
265 |
+
with gr.Tab("Reset"):
|
266 |
+
reset_button = gr.Button("Reset ChatBot Instance")
|
267 |
+
reset_output = gr.Textbox(label="Reset Output", interactive=False)
|
268 |
+
reset_button.click(reset_all, inputs=[], outputs=[reset_output])
|
|
|
|
|
|
|
|
|
|
|
269 |
|
270 |
if __name__ == "__main__":
|
271 |
+
app.launch(debug=True)
|