Spaces:
Sleeping
Sleeping
Commit
·
ac790b7
1
Parent(s):
627e6af
chore: download onnx-data on spaces
Browse filesSigned-off-by: Suvaditya Mukherjee <suvadityamuk@gmail.com>
app.py
CHANGED
@@ -6,6 +6,7 @@ import requests
|
|
6 |
import wandb
|
7 |
import torch
|
8 |
import spaces
|
|
|
9 |
import psutil
|
10 |
import pymupdf
|
11 |
import gradio as gr
|
@@ -101,9 +102,23 @@ if __name__ == "__main__":
|
|
101 |
RESUME_URL = "https://drive.google.com/file/d/1YMF9NNTG5gubwJ7ipI5JfxAJKhlD9h2v/"
|
102 |
|
103 |
ONNX_MODEL_PATH = "https://huggingface.co/onnx-community/Qwen2.5-1.5B-Instruct/resolve/main/onnx/model.onnx_data"
|
|
|
104 |
|
105 |
print("Downloading ONNX model...")
|
106 |
response = requests.get(ONNX_MODEL_PATH, stream=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
print("Downloaded ONNX model!")
|
108 |
|
109 |
# Download file
|
|
|
6 |
import wandb
|
7 |
import torch
|
8 |
import spaces
|
9 |
+
import tqdm
|
10 |
import psutil
|
11 |
import pymupdf
|
12 |
import gradio as gr
|
|
|
102 |
RESUME_URL = "https://drive.google.com/file/d/1YMF9NNTG5gubwJ7ipI5JfxAJKhlD9h2v/"
|
103 |
|
104 |
ONNX_MODEL_PATH = "https://huggingface.co/onnx-community/Qwen2.5-1.5B-Instruct/resolve/main/onnx/model.onnx_data"
|
105 |
+
SAVE_PATH = "./model.onnx_data"
|
106 |
|
107 |
print("Downloading ONNX model...")
|
108 |
response = requests.get(ONNX_MODEL_PATH, stream=True)
|
109 |
+
response.raise_for_status()
|
110 |
+
|
111 |
+
total_size = int(response.headers.get('content-length', 0))
|
112 |
+
|
113 |
+
with open(SAVE_PATH, 'wb') as file, tqdm(
|
114 |
+
desc=os.path.basename(SAVE_PATH),
|
115 |
+
total=total_size,
|
116 |
+
unit='iB',
|
117 |
+
unit_scale=True
|
118 |
+
) as pbar:
|
119 |
+
for data in response.iter_content(chunk_size=8192):
|
120 |
+
size = file.write(data)
|
121 |
+
pbar.update(size)
|
122 |
print("Downloaded ONNX model!")
|
123 |
|
124 |
# Download file
|