Spaces:
Runtime error
Runtime error
Commit ·
a9e4ada
1
Parent(s): 7e78030
Update app.py
Browse files
app.py
CHANGED
|
@@ -261,26 +261,20 @@ def onResetToDefaultSelection():
|
|
| 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
|
| 277 |
# Save processed data to temporary file
|
| 278 |
|
| 279 |
logFiles = [file for file in os.listdir(logsDir) if 'log' in file.lower()]
|
| 280 |
print(logFiles,"avaiable logs")
|
| 281 |
|
| 282 |
-
|
| 283 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
|
| 285 |
|
| 286 |
with gr.Blocks() as demo:
|
|
@@ -345,18 +339,10 @@ with gr.Blocks() as demo:
|
|
| 345 |
|
| 346 |
#screen 4 for downloading logs
|
| 347 |
with gr.Tab("Log-files"):
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
for downloadableFile in downloadableFiles:
|
| 351 |
-
filePath = os.path.join(os.path.abspath(logsDir), downloadableFile["name"])
|
| 352 |
-
print(filePath)
|
| 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=
|
| 358 |
-
|
| 359 |
-
|
| 360 |
|
| 361 |
demo.launch(share=True, debug=True, ssl_verify=False, auth=checkAuth)
|
| 362 |
dbEngine.connect()
|
|
|
|
| 261 |
|
| 262 |
return tableBoxes
|
| 263 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 264 |
def getAllLogFilesUrls():
|
| 265 |
+
global logsDir
|
| 266 |
# Save processed data to temporary file
|
| 267 |
|
| 268 |
logFiles = [file for file in os.listdir(logsDir) if 'log' in file.lower()]
|
| 269 |
print(logFiles,"avaiable logs")
|
| 270 |
|
| 271 |
+
downloadableFilesPaths = [os.path.join(os.path.abspath(logsDir), logFilePath) for logFilePath in logFiles]
|
| 272 |
+
return downloadableFilesPaths
|
| 273 |
+
|
| 274 |
+
def onSyncLogsWithDataDir():
|
| 275 |
+
downloadableFilesPaths = getAllLogFilesPaths()
|
| 276 |
+
fileComponent = gr.File(downloadableFilesPaths, file_count='multiple')
|
| 277 |
+
return fileComponents
|
| 278 |
|
| 279 |
|
| 280 |
with gr.Blocks() as demo:
|
|
|
|
| 339 |
|
| 340 |
#screen 4 for downloading logs
|
| 341 |
with gr.Tab("Log-files"):
|
| 342 |
+
downloadableFilesPaths = getAllLogFilesPaths()
|
| 343 |
+
fileComponent = gr.File(downloadableFilesPaths, file_count='multiple')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
refreshLogs = gr.Button("Sync Log files from /data")
|
| 345 |
+
refreshLogs.click(onSyncLogsWithDataDir, inputs=None, outputs=fileComponent)
|
|
|
|
|
|
|
| 346 |
|
| 347 |
demo.launch(share=True, debug=True, ssl_verify=False, auth=checkAuth)
|
| 348 |
dbEngine.connect()
|