abidlabs HF Staff commited on
Commit
174c369
·
1 Parent(s): 6ed84c5

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
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
+