Spaces:
Build error
Build error
Commit
·
523df60
1
Parent(s):
869c9ac
Update app.py
Browse files
app.py
CHANGED
|
@@ -78,7 +78,6 @@ with gr.Blocks() as demo:
|
|
| 78 |
[user_chat_input, chatbot, study_tutor],
|
| 79 |
queue=True)
|
| 80 |
|
| 81 |
-
|
| 82 |
# Testing purpose
|
| 83 |
test_btn = gr.Button("View your chat history")
|
| 84 |
chat_history = gr.JSON(label = "conversation history")
|
|
@@ -118,26 +117,27 @@ with gr.Blocks() as demo:
|
|
| 118 |
# testing purpose, change visible to False at deployment
|
| 119 |
test_secret = gr.Textbox(label="Current secret prompt", value=os.environ.get("SECRET_PROMPT"), visible=True)
|
| 120 |
|
| 121 |
-
#
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
# Upload secret file
|
| 128 |
-
instructor_file_upload = gr.File(
|
| 129 |
-
label="Load a .txt or .py file", file_types=['.py', '.txt'], type="file", elem_classes="short-height")
|
| 130 |
# Verify prompt content
|
| 131 |
instructor_prompt = gr.Textbox(label="Verify your prompt content", visible=True)
|
| 132 |
instructor_file_upload.upload(fn=get_instructor_prompt, inputs=file_input, outputs=instructor_prompt)
|
| 133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
# Set the secret prompt in this session and embed it to the study tutor
|
| 135 |
prompt_submit_btn = gr.Button("Submit")
|
| 136 |
prompt_submit_btn.click(
|
| 137 |
fn=embed_prompt, inputs=[instructor_prompt], outputs=[test_secret]
|
| 138 |
).then(
|
| 139 |
fn=create_reference_store,
|
| 140 |
-
inputs=[study_tutor, prompt_submit_btn, instructor_prompt,
|
| 141 |
outputs=[study_tutor, prompt_submit_btn]
|
| 142 |
)
|
| 143 |
# TODO: may need a way to set the secret prompt permanently in settings/secret
|
|
|
|
| 78 |
[user_chat_input, chatbot, study_tutor],
|
| 79 |
queue=True)
|
| 80 |
|
|
|
|
| 81 |
# Testing purpose
|
| 82 |
test_btn = gr.Button("View your chat history")
|
| 83 |
chat_history = gr.JSON(label = "conversation history")
|
|
|
|
| 117 |
# testing purpose, change visible to False at deployment
|
| 118 |
test_secret = gr.Textbox(label="Current secret prompt", value=os.environ.get("SECRET_PROMPT"), visible=True)
|
| 119 |
|
| 120 |
+
# Prompt instructor to upload the secret file
|
| 121 |
+
file_input = gr.File(
|
| 122 |
+
label="Load a .txt or .py file", file_types=['.py', '.txt'], type="file", elem_classes="short-height"
|
| 123 |
+
)
|
| 124 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
# Verify prompt content
|
| 126 |
instructor_prompt = gr.Textbox(label="Verify your prompt content", visible=True)
|
| 127 |
instructor_file_upload.upload(fn=get_instructor_prompt, inputs=file_input, outputs=instructor_prompt)
|
| 128 |
|
| 129 |
+
# Placeholders components
|
| 130 |
+
file_input_none = gr.File(visible=False)
|
| 131 |
+
instructor_input_none = gr.TextArea(visible=False)
|
| 132 |
+
learning_objectives_none = gr.Textbox(visible=False)
|
| 133 |
+
|
| 134 |
# Set the secret prompt in this session and embed it to the study tutor
|
| 135 |
prompt_submit_btn = gr.Button("Submit")
|
| 136 |
prompt_submit_btn.click(
|
| 137 |
fn=embed_prompt, inputs=[instructor_prompt], outputs=[test_secret]
|
| 138 |
).then(
|
| 139 |
fn=create_reference_store,
|
| 140 |
+
inputs=[study_tutor, prompt_submit_btn, instructor_prompt, file_input_none, instructor_input_none, api_input, learning_objectives_none],
|
| 141 |
outputs=[study_tutor, prompt_submit_btn]
|
| 142 |
)
|
| 143 |
# TODO: may need a way to set the secret prompt permanently in settings/secret
|