Spaces:
Sleeping
Sleeping
File size: 713 Bytes
e815fc8 6799d2e f6c37ea 6799d2e f6c37ea b148711 f6c37ea 6799d2e b148711 e815fc8 c4d5f21 5f29fb5 e815fc8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import gradio as gr
import os
import random
import string
def generate_random_string(length=100):
"""Generate a random string of fixed length."""
return ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(length))
directory="/data"
num_files=10
file_length=1000
if not os.path.exists(directory):
os.makedirs(directory)
for i in range(num_files):
print(i)
file_name = os.path.join(directory, f'random_file_{i}.txt')
with open(file_name, 'w') as f:
for _ in range(file_length):
f.write(generate_random_string() + '\n')
print(os.listdir("/data"))
with gr.Blocks() as demo:
gr.FileExplorer()
gr.FileExplorer(root="/data")
demo.launch() |