Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def print_flagged_dir_and_csv(x):
|
| 4 |
+
dirtree = ""
|
| 5 |
+
startpath = "flagged"
|
| 6 |
+
for root, dirs, files in os.walk(startpath):
|
| 7 |
+
level = root.replace(startpath, '').count(os.sep)
|
| 8 |
+
indent = ' ' * 4 * (level)
|
| 9 |
+
dirtree += '{}{}/\n'.format(indent, os.path.basename(root))
|
| 10 |
+
subindent = ' ' * 4 * (level + 1)
|
| 11 |
+
for f in files:
|
| 12 |
+
dirtree += '{}{}\n'.format(subindent, f)
|
| 13 |
+
return dirtree, "flagged/log.csv"
|
| 14 |
+
|
| 15 |
+
gr.Interface(print_flagged_dir_and_csv, "textbox", ["textbox", "file"]).launch()
|
| 16 |
+
|