Spaces:
Sleeping
Sleeping
File size: 663 Bytes
96a1566 174c369 0e55f17 174c369 e2561a2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import os
import gradio as gr
def print_flagged_dir_and_csv(x):
dirtree = ""
startpath = "flagged"
for root, dirs, files in os.walk(startpath):
level = root.replace(startpath, '').count(os.sep)
indent = ' ' * 4 * (level)
dirtree += '{}{}/\n'.format(indent, os.path.basename(root))
subindent = ' ' * 4 * (level + 1)
for f in files:
dirtree += '{}{}\n'.format(subindent, f)
if os.path.exists("flagged/log.csv"):
file = "flagged/log.csv"
else:
file = None
return dirtree, file
gr.Interface(print_flagged_dir_and_csv, "textbox", "textbox", allow_flagging=True).launch() |