anumaurya114exp commited on
Commit
7e78030
·
1 Parent(s): def2f32

adding refresh button for logging synch with data dir

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -261,6 +261,16 @@ def onResetToDefaultSelection():
261
 
262
  return tableBoxes
263
 
 
 
 
 
 
 
 
 
 
 
264
 
265
  def getAllLogFilesUrls():
266
  global logs_dir
@@ -343,5 +353,10 @@ with gr.Blocks() as demo:
343
  fileComponent = gr.File(filePath)
344
  fileComponents.append(fileComponent)
345
 
 
 
 
 
 
346
  demo.launch(share=True, debug=True, ssl_verify=False, auth=checkAuth)
347
  dbEngine.connect()
 
261
 
262
  return tableBoxes
263
 
264
+ def onSyncLogsWithDataDir():
265
+ downloadableFiles = getAllLogFilesUrls()
266
+ fileComponents = []
267
+ for downloadableFile in downloadableFiles:
268
+ filePath = os.path.join(os.path.abspath(logsDir), downloadableFile["name"])
269
+ print(filePath)
270
+ fileComponent = gr.File(filePath)
271
+ fileComponents.append(fileComponent)
272
+ return fileComponents
273
+
274
 
275
  def getAllLogFilesUrls():
276
  global logs_dir
 
353
  fileComponent = gr.File(filePath)
354
  fileComponents.append(fileComponent)
355
 
356
+ refreshLogs = gr.Button("Sync Log files from /data")
357
+ refreshLogs.click(onSyncLogsWithDataDir, inputs=None, outputs=fileComponents)
358
+
359
+
360
+
361
  demo.launch(share=True, debug=True, ssl_verify=False, auth=checkAuth)
362
  dbEngine.connect()