wasmdashai commited on
Commit
cfb30b8
·
verified ·
1 Parent(s): 262c091

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -9,9 +9,8 @@ class OnnxModelConverter:
9
  def __init__(self):
10
  self.model = None
11
  def download_file(self,file_path):
12
- ff= gr.File(value=file_path, visible=True)
13
- file_url = ff.value['url']
14
- return file_url
15
 
16
  def convert(self, model_name, token, onnx_filename, conversion_type):
17
  """
@@ -62,7 +61,7 @@ class OnnxModelConverter:
62
  dynamic_axes={'input': {0: 'batch_size', 1: 'sequence_length'}, 'output': {0: 'batch_size'}}
63
  )
64
 
65
- return onnx_file
66
 
67
 
68
  def convert_only_decoder(self, model_name, token, onnx_filename):
@@ -93,7 +92,7 @@ class OnnxModelConverter:
93
  dynamic_axes={'input': {0: 'batch_size', 1: 'sequence_length'}, 'output': {0: 'batch_size'}}
94
  )
95
 
96
- return onnx_file
97
 
98
  def convert_full_model(self, model_name, token, onnx_filename):
99
  """
@@ -123,7 +122,7 @@ class OnnxModelConverter:
123
  dynamic_axes={'input': {0: 'batch_size', 1: 'sequence_length'}, 'output': {0: 'batch_size'}}
124
  )
125
 
126
- return onnx_file
127
  def starrt(self):
128
  with gr.Blocks() as demo:
129
  with gr.Row():
 
9
  def __init__(self):
10
  self.model = None
11
  def download_file(self,file_path):
12
+ with open("file.name", "wb") as f:
13
+ return file.read()
 
14
 
15
  def convert(self, model_name, token, onnx_filename, conversion_type):
16
  """
 
61
  dynamic_axes={'input': {0: 'batch_size', 1: 'sequence_length'}, 'output': {0: 'batch_size'}}
62
  )
63
 
64
+ return self.download_file(onnx_file)
65
 
66
 
67
  def convert_only_decoder(self, model_name, token, onnx_filename):
 
92
  dynamic_axes={'input': {0: 'batch_size', 1: 'sequence_length'}, 'output': {0: 'batch_size'}}
93
  )
94
 
95
+ return self.download_file(onnx_file)
96
 
97
  def convert_full_model(self, model_name, token, onnx_filename):
98
  """
 
122
  dynamic_axes={'input': {0: 'batch_size', 1: 'sequence_length'}, 'output': {0: 'batch_size'}}
123
  )
124
 
125
+ return self.download_file(onnx_file)
126
  def starrt(self):
127
  with gr.Blocks() as demo:
128
  with gr.Row():