Spaces:
Build error
Build error
Commit
·
eb4fba4
1
Parent(s):
e4eba59
Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,12 @@ def get_tutor_reply(user_message, chat_tutor):
|
|
36 |
|
37 |
def get_conversation_history(chat_tutor):
|
38 |
return chat_tutor.conversation_memory, chat_tutor
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
with gr.Blocks() as demo:
|
42 |
#initialize tutor (with state)
|
@@ -86,11 +91,14 @@ with gr.Blocks() as demo:
|
|
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 |
with gr.Blocks():
|
91 |
-
|
92 |
file_types=['.py', '.txt'], type="file",
|
93 |
elem_classes="short-height")
|
|
|
|
|
|
|
94 |
|
95 |
|
96 |
demo.queue().launch(server_name='0.0.0.0', server_port=7860)
|
|
|
36 |
|
37 |
def get_conversation_history(chat_tutor):
|
38 |
return chat_tutor.conversation_memory, chat_tutor
|
39 |
+
|
40 |
+
def get_instructor_prompt(fileobj):
|
41 |
+
file_path = fileobj.name
|
42 |
+
f = open(file_path, "r")
|
43 |
+
instructor_prompt = f.read()
|
44 |
+
return instructor_prompt
|
45 |
|
46 |
with gr.Blocks() as demo:
|
47 |
#initialize tutor (with state)
|
|
|
91 |
export_dialogue_button_txt.click(save_txt, study_tutor, file_download, show_progress=True)
|
92 |
export_dialogue_button_csv.click(save_csv, study_tutor, file_download, show_progress=True)
|
93 |
|
94 |
+
with gr.Tab("Instructor Only"):
|
95 |
with gr.Blocks():
|
96 |
+
file_input = gr.File(label="Load a .txt or .py file",
|
97 |
file_types=['.py', '.txt'], type="file",
|
98 |
elem_classes="short-height")
|
99 |
+
instructor_prompt = get_instructor_prompt(file_input)
|
100 |
+
os.environ["SECRET_PROMPT"] = instructor_prompt
|
101 |
+
gr.Textbox(value=instructor_prompt)
|
102 |
|
103 |
|
104 |
demo.queue().launch(server_name='0.0.0.0', server_port=7860)
|