brunhild217 commited on
Commit
23a6ca9
·
1 Parent(s): daf6d51

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -122,16 +122,18 @@ with gr.Blocks() as demo:
122
  # testing purpose, change visible to False at deployment
123
  test_secret = gr.Textbox(label="Current secret prompt", value=os.environ.get("SECRET_PROMPT"), visible=True)
124
 
 
125
  text_input = gr.TextArea(visible=False)
126
- file_input = gr.File(label="Load a .txt or .py file",
127
- file_types=['.py', '.txt'], type="file",
128
- elem_classes="short-height")
129
  instructor_input = gr.TextArea(visible=False)
130
  learning_objectives = gr.Textbox(visible=False)
131
 
 
 
 
132
  # Verify prompt content
133
  instructor_prompt = gr.Textbox(label="Verify your prompt content", visible=True)
134
- file_input.upload(fn=get_instructor_prompt, inputs=file_input, outputs=instructor_prompt)
135
 
136
  # Set the secret prompt in this session and embed it to the study tutor
137
  prompt_submit_btn = gr.Button("Submit")
@@ -139,7 +141,7 @@ with gr.Blocks() as demo:
139
  fn=embed_prompt, inputs=[instructor_prompt], outputs=[test_secret]
140
  ).then(
141
  fn=create_reference_store,
142
- inputs=[study_tutor, prompt_submit_btn, text_input, file_input, instructor_input, api_input, learning_objectives],
143
  outputs=[study_tutor, prompt_submit_btn]
144
  )
145
  # TODO: may need a way to set the secret prompt permanently in settings/secret
 
122
  # testing purpose, change visible to False at deployment
123
  test_secret = gr.Textbox(label="Current secret prompt", value=os.environ.get("SECRET_PROMPT"), visible=True)
124
 
125
+ # Just placeholders components
126
  text_input = gr.TextArea(visible=False)
127
+ file_input = gr.File(visible=False)
 
 
128
  instructor_input = gr.TextArea(visible=False)
129
  learning_objectives = gr.Textbox(visible=False)
130
 
131
+ # Upload secret file
132
+ instructor_file_upload = gr.File(
133
+ label="Load a .txt or .py file", file_types=['.py', '.txt'], type="file", elem_classes="short-height")
134
  # Verify prompt content
135
  instructor_prompt = gr.Textbox(label="Verify your prompt content", visible=True)
136
+ instructor_file_upload.upload(fn=get_instructor_prompt, inputs=file_input, outputs=instructor_prompt)
137
 
138
  # Set the secret prompt in this session and embed it to the study tutor
139
  prompt_submit_btn = gr.Button("Submit")
 
141
  fn=embed_prompt, inputs=[instructor_prompt], outputs=[test_secret]
142
  ).then(
143
  fn=create_reference_store,
144
+ inputs=[study_tutor, prompt_submit_btn, instructor_prompt, file_input, instructor_input, api_input, learning_objectives],
145
  outputs=[study_tutor, prompt_submit_btn]
146
  )
147
  # TODO: may need a way to set the secret prompt permanently in settings/secret