Spaces:
Runtime error
Runtime error
File size: 650 Bytes
104062e 8fb8835 104062e 8fb8835 |
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 |
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()
|