Spaces:
Runtime error
Runtime error
| from pathlib import Path | |
| import gradio as gr | |
| from huggingface_hub import snapshot_download | |
| snapshot_download("tiiuae/falcon-7b") | |
| DATA_PATH = "/data" | |
| def get_storage(): | |
| dir = Path(DATA_PATH) | |
| files = [str(f) for f in dir.glob("**/*") if f.is_file()] | |
| usage = sum([f.stat().st_size for f in dir.glob("**/*") if f.is_file()]) | |
| return files, f"{usage/(1024.0 ** 3):.3f}GB" | |
| with gr.Blocks() as app: | |
| with gr.Row(): | |
| with gr.Column(): | |
| btn = gr.Button("Run") | |
| with gr.Column(): | |
| files = gr.Files(label="Files") | |
| storage = gr.Text(label="Total Usage") | |
| btn.click(get_storage, None, [files, storage]) | |
| app.launch() | |