SaisExperiments commited on
Commit
421dbc3
·
verified ·
1 Parent(s): fefebc3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __all__ = ['iface', 'size']
2
+
3
+ import gradio as gr
4
+ from fastcore.net import urljson, HTTPError
5
+
6
+ def size(repo:str):
7
+ "Returns the size in GB of a HuggingFace Model Repo."
8
+ url = f'https://huggingface.co/api/models/{repo}'
9
+ try:
10
+ resp = urljson(f'{url}/treesize/main')
11
+ gb = resp['size'] / 1e9
12
+ return f'{gb:.2f} GB'
13
+ except HTTPError:
14
+ return f'Did not find repo: {url}'
15
+
16
+ iface = gr.Interface(fn=size, inputs=gr.Text(value="Qwen/Qwen2.5-Coder-32B-Instruct"), outputs="text")
17
+ iface.launch(height=450, width=500)