dishav2 commited on
Commit
8e5dfda
1 Parent(s): 885425a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -14
app.py CHANGED
@@ -180,24 +180,17 @@ def reset_data():
180
  # Use shutil.rmtree() to delete output, docs, and vector_stores folders, reset grader and grader_qa, and get_grading_status, reset and return history
181
  global grader, grader_qa
182
  #If there's data in docs/output folder during grading [During Grading]
183
- if os.path.isdir('output') and len(glob.glob("output/*.csv")) > 0 and len(glob.glob("docs/*.json")) > 0 and len(
184
- glob.glob("docs/*.html")) > 0:
185
  reset_folder('output')
186
  reset_folder('docs')
 
187
  grader = None
188
  grader_qa = None
189
  history = [(None, 'Data reset successfully')]
190
- return history, enabled, enabled, enabled, disabled, disabled, disabled
191
- # If there's data in docs folder [During Ingestion]
192
- elif len(glob.glob("docs/*.json")) > 0 and len(glob.glob("docs/*.html")):
193
- reset_folder('docs')
194
- history = [(None, 'Data reset successfully')]
195
- return history, enabled, enabled, enabled, disabled, disabled, disabled
196
- #If there's data in vector_stores folder
197
- elif len(glob.glob("vector_stores/*.faiss")) > 0 or len(glob.glob("vector_stores/*.pkl")) > 0:
198
- reset_folder('vector_stores')
199
- history = [(None, 'Data reset successfully')]
200
- return history, enabled, enabled, enabled, disabled, disabled, disabled
201
 
202
 
203
  def get_output_dir(orig_name):
@@ -296,7 +289,7 @@ with gr.Blocks() as demo:
296
  bot, chatbot, chatbot
297
  )
298
 
299
- reset.click(reset_data, inputs=[], outputs=[chatbot, url, canvas_api_key, submit, table, grade, download]).success(
300
  bot, chatbot, chatbot)
301
 
302
  upload.upload(upload_grading_results, inputs=[upload, chatbot], outputs=[chatbot], postprocess=False, ).then(
 
180
  # Use shutil.rmtree() to delete output, docs, and vector_stores folders, reset grader and grader_qa, and get_grading_status, reset and return history
181
  global grader, grader_qa
182
  #If there's data in docs/output folder during grading [During Grading]
183
+ if os.path.isdir('output') and len(glob.glob("output/*.csv")) > 0 or len(glob.glob("docs/*.json")) > 0 or len(
184
+ glob.glob("docs/*.html")) > 0 or len(glob.glob("vector_stores/*.faiss")) > 0 or len(glob.glob("vector_stores/*.pkl")) > 0:
185
  reset_folder('output')
186
  reset_folder('docs')
187
+ reset_folder('vector_stores')
188
  grader = None
189
  grader_qa = None
190
  history = [(None, 'Data reset successfully')]
191
+ url.placeholder = [(None, 'Enter your Canvas Discussion URL')]
192
+ canvas_api_key.placeholder = [(None, 'Enter your Canvas API Key')]
193
+ return history, enabled, enabled, enabled, disabled, disabled, disabled, disabled, disabled, disabled, disabled, disabled
 
 
 
 
 
 
 
 
194
 
195
 
196
  def get_output_dir(orig_name):
 
289
  bot, chatbot, chatbot
290
  )
291
 
292
+ reset.click(reset_data, inputs=[], outputs=[chatbot, url, canvas_api_key, submit, table, grade, download, txt, file, upload, ask]).success(
293
  bot, chatbot, chatbot)
294
 
295
  upload.upload(upload_grading_results, inputs=[upload, chatbot], outputs=[chatbot], postprocess=False, ).then(