Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,25 @@
|
|
|
|
|
|
1 |
from huggingface_hub import snapshot_download
|
2 |
|
3 |
snapshot_download("tiiuae/falcon-7b")
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
with gr.Blocks() as demo:
|
10 |
-
gr.Markdown("Start typing below and then click **Run** to see the output.")
|
11 |
-
with gr.Row():
|
12 |
-
inp = gr.Textbox(placeholder="What is your name?")
|
13 |
-
out = gr.Textbox()
|
14 |
-
btn = gr.Button("Run")
|
15 |
-
btn.click(fn=update, inputs=inp, outputs=out)
|
16 |
|
17 |
-
demo.launch()
|
|
|
1 |
+
from pathlib import Path
|
2 |
+
import gradio as gr
|
3 |
from huggingface_hub import snapshot_download
|
4 |
|
5 |
snapshot_download("tiiuae/falcon-7b")
|
6 |
|
7 |
+
DATA_PATH = "." # "/data"
|
8 |
+
|
9 |
+
def get_storage():
|
10 |
+
dir = Path(DATA_PATH)
|
11 |
+
files = [str(f) for f in dir.glob("**/*") if f.is_file()]
|
12 |
+
usage = sum([f.stat().st_size for f in dir.glob("**/*") if f.is_file()])
|
13 |
+
return files, f"{usage/(1024.0 ** 3):.3f}GB"
|
14 |
+
|
15 |
+
with gr.Blocks() as app:
|
16 |
+
with gr.Row():
|
17 |
+
with gr.Column():
|
18 |
+
btn = gr.Button("Run")
|
19 |
+
with gr.Column():
|
20 |
+
files = gr.Files(label="Files")
|
21 |
+
storage = gr.Text(label="Total Usage")
|
22 |
+
btn.click(get_storage, None, [files, storage])
|
23 |
+
app.launch()
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
|