Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,10 @@ import random
|
|
| 4 |
import string
|
| 5 |
import glob
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
def generate_random_string(length=100):
|
| 8 |
"""Generate a random string of fixed length."""
|
| 9 |
return ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(length))
|
|
@@ -22,6 +26,11 @@ for directory in ["/data", "/data/special"]:
|
|
| 22 |
for _ in range(file_length):
|
| 23 |
f.write(generate_random_string() + '\n')
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
with gr.Blocks() as demo:
|
| 26 |
gr.FileExplorer(label="Working directory")
|
| 27 |
gr.FileExplorer(root="/data", label="Persistent storage")
|
|
|
|
| 4 |
import string
|
| 5 |
import glob
|
| 6 |
|
| 7 |
+
##############################################################
|
| 8 |
+
# Generate some text files and save them in persistent storage
|
| 9 |
+
##############################################################
|
| 10 |
+
|
| 11 |
def generate_random_string(length=100):
|
| 12 |
"""Generate a random string of fixed length."""
|
| 13 |
return ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(length))
|
|
|
|
| 26 |
for _ in range(file_length):
|
| 27 |
f.write(generate_random_string() + '\n')
|
| 28 |
|
| 29 |
+
|
| 30 |
+
##############################################################
|
| 31 |
+
# The Gradio app
|
| 32 |
+
##############################################################
|
| 33 |
+
|
| 34 |
with gr.Blocks() as demo:
|
| 35 |
gr.FileExplorer(label="Working directory")
|
| 36 |
gr.FileExplorer(root="/data", label="Persistent storage")
|