Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,8 +9,11 @@ class OnnxModelConverter:
|
|
9 |
def __init__(self):
|
10 |
self.model = None
|
11 |
def download_file(self,file_path):
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
14 |
|
15 |
def convert(self, model_name, token, onnx_filename, conversion_type):
|
16 |
"""
|
@@ -61,7 +64,7 @@ class OnnxModelConverter:
|
|
61 |
dynamic_axes={'input': {0: 'batch_size', 1: 'sequence_length'}, 'output': {0: 'batch_size'}}
|
62 |
)
|
63 |
|
64 |
-
return onnx_file
|
65 |
|
66 |
|
67 |
def convert_only_decoder(self, model_name, token, onnx_filename):
|
@@ -92,7 +95,7 @@ class OnnxModelConverter:
|
|
92 |
dynamic_axes={'input': {0: 'batch_size', 1: 'sequence_length'}, 'output': {0: 'batch_size'}}
|
93 |
)
|
94 |
|
95 |
-
return onnx_file
|
96 |
|
97 |
def convert_full_model(self, model_name, token, onnx_filename):
|
98 |
"""
|
@@ -122,7 +125,7 @@ class OnnxModelConverter:
|
|
122 |
dynamic_axes={'input': {0: 'batch_size', 1: 'sequence_length'}, 'output': {0: 'batch_size'}}
|
123 |
)
|
124 |
|
125 |
-
return onnx_file
|
126 |
def starrt(self):
|
127 |
with gr.Blocks() as demo:
|
128 |
with gr.Row():
|
|
|
9 |
def __init__(self):
|
10 |
self.model = None
|
11 |
def download_file(self,file_path):
|
12 |
+
if not os.path.exists(file_path):
|
13 |
+
with open(file_path, "w") as file:
|
14 |
+
file.write("This is a test ONNX model.")
|
15 |
+
return gr.File(file_path, label="Download ONNX File")
|
16 |
+
|
17 |
|
18 |
def convert(self, model_name, token, onnx_filename, conversion_type):
|
19 |
"""
|
|
|
64 |
dynamic_axes={'input': {0: 'batch_size', 1: 'sequence_length'}, 'output': {0: 'batch_size'}}
|
65 |
)
|
66 |
|
67 |
+
return self.download_file(onnx_file)
|
68 |
|
69 |
|
70 |
def convert_only_decoder(self, model_name, token, onnx_filename):
|
|
|
95 |
dynamic_axes={'input': {0: 'batch_size', 1: 'sequence_length'}, 'output': {0: 'batch_size'}}
|
96 |
)
|
97 |
|
98 |
+
return self.download_file(onnx_file)
|
99 |
|
100 |
def convert_full_model(self, model_name, token, onnx_filename):
|
101 |
"""
|
|
|
125 |
dynamic_axes={'input': {0: 'batch_size', 1: 'sequence_length'}, 'output': {0: 'batch_size'}}
|
126 |
)
|
127 |
|
128 |
+
return self.download_file(onnx_file)
|
129 |
def starrt(self):
|
130 |
with gr.Blocks() as demo:
|
131 |
with gr.Row():
|