Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import gradio as gr
|
|
| 2 |
import numpy
|
| 3 |
import torch
|
| 4 |
import requests
|
|
|
|
| 5 |
from huggingface_hub import HfApi, ModelFilter, list_models, list_repo_files, hf_hub_download
|
| 6 |
api = HfApi()
|
| 7 |
|
|
@@ -14,8 +15,8 @@ def list_files(model_name):
|
|
| 14 |
|
| 15 |
def load_bin(model_name,file_name):
|
| 16 |
r = requests.get(f'https://huggingface.co/{model_name}/resolve/main/{file_name}')
|
| 17 |
-
result=torch.frombuffer(r,dtype=torch.get_default_dtype())
|
| 18 |
-
|
| 19 |
return result
|
| 20 |
#with open()
|
| 21 |
#file = open(f'{name}/{f_name}','wb')
|
|
|
|
| 2 |
import numpy
|
| 3 |
import torch
|
| 4 |
import requests
|
| 5 |
+
import io
|
| 6 |
from huggingface_hub import HfApi, ModelFilter, list_models, list_repo_files, hf_hub_download
|
| 7 |
api = HfApi()
|
| 8 |
|
|
|
|
| 15 |
|
| 16 |
def load_bin(model_name,file_name):
|
| 17 |
r = requests.get(f'https://huggingface.co/{model_name}/resolve/main/{file_name}')
|
| 18 |
+
#result=torch.frombuffer(r,dtype=torch.get_default_dtype())
|
| 19 |
+
result = torch.load(io.BytesIO(r.content))
|
| 20 |
return result
|
| 21 |
#with open()
|
| 22 |
#file = open(f'{name}/{f_name}','wb')
|