Spaces:
Build error
Build error
Commit
·
cddb36c
1
Parent(s):
92a0a4b
Update app.py
Browse files
app.py
CHANGED
@@ -64,33 +64,31 @@ with gr.Blocks() as demo:
|
|
64 |
[user_chat_input, study_tutor],
|
65 |
[chatbot, study_tutor], queue=False).then(
|
66 |
get_tutor_reply, [user_chat_input, study_tutor], [user_chat_input, chatbot, study_tutor], queue=True)
|
67 |
-
|
68 |
-
with gr.Tab("Instructor Only"):
|
69 |
-
file_input = gr.Files(label="Load a .txt or .pdf file",
|
70 |
-
file_types=['.pdf', '.txt'], type="file",
|
71 |
-
elem_classes="short-height")
|
72 |
-
|
73 |
-
# Testing purpose
|
74 |
-
test_btn = gr.Button("View your chat history")
|
75 |
-
chat_history = gr.JSON(label = "conversation history")
|
76 |
-
test_btn.click(get_conversation_history, inputs=[study_tutor], outputs=[chat_history, study_tutor])
|
77 |
|
78 |
-
|
79 |
-
gr.
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
with gr.
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
-
|
89 |
-
file_types=['.json', '.txt', '.csv'], type="file", visible=False)
|
90 |
|
91 |
export_dialogue_button_json.click(save_json, study_tutor, file_download, show_progress=True)
|
92 |
export_dialogue_button_txt.click(save_txt, study_tutor, file_download, show_progress=True)
|
93 |
export_dialogue_button_csv.click(save_csv, study_tutor, file_download, show_progress=True)
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
96 |
demo.queue().launch(server_name='0.0.0.0', server_port=7860)
|
|
|
64 |
[user_chat_input, study_tutor],
|
65 |
[chatbot, study_tutor], queue=False).then(
|
66 |
get_tutor_reply, [user_chat_input, study_tutor], [user_chat_input, chatbot, study_tutor], queue=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
+
# Testing purpose
|
69 |
+
test_btn = gr.Button("View your chat history")
|
70 |
+
chat_history = gr.JSON(label = "conversation history")
|
71 |
+
test_btn.click(get_conversation_history, inputs=[study_tutor], outputs=[chat_history, study_tutor])
|
72 |
+
|
73 |
+
with gr.Blocks():
|
74 |
+
gr.Markdown("""
|
75 |
+
## Export Your Chat History
|
76 |
+
Export your chat history as a .json, .txt, or .csv file
|
77 |
+
""")
|
78 |
+
with gr.Row():
|
79 |
+
export_dialogue_button_json = gr.Button("JSON")
|
80 |
+
export_dialogue_button_txt = gr.Button("TXT")
|
81 |
+
export_dialogue_button_csv = gr.Button("CSV")
|
82 |
|
83 |
+
file_download = gr.Files(label="Download here", file_types=['.json', '.txt', '.csv'], type="file", visible=False)
|
|
|
84 |
|
85 |
export_dialogue_button_json.click(save_json, study_tutor, file_download, show_progress=True)
|
86 |
export_dialogue_button_txt.click(save_txt, study_tutor, file_download, show_progress=True)
|
87 |
export_dialogue_button_csv.click(save_csv, study_tutor, file_download, show_progress=True)
|
88 |
+
|
89 |
+
with gr.Tab("Instructor Only"):
|
90 |
+
file_input = gr.Files(label="Load a .txt or .pdf file",
|
91 |
+
file_types=['.pdf', '.txt'], type="file",
|
92 |
+
elem_classes="short-height")
|
93 |
+
|
94 |
demo.queue().launch(server_name='0.0.0.0', server_port=7860)
|