wasmdashai commited on
Commit
5d09115
·
verified ·
1 Parent(s): a6b8bd1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -5,9 +5,22 @@ from VitsModelSplit.vits_model_only_d import Vits_models_only_decoder
5
  from VitsModelSplit.vits_model import VitsModel
6
  import gradio as gr
7
  import os
 
 
 
 
 
 
 
 
 
 
 
8
  class OnnxModelConverter:
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:
@@ -140,6 +153,7 @@ class OnnxModelConverter:
140
  btn=gr.Button("convert")
141
  label=gr.Label("return name model onxx")
142
  btn.click(self.convert,[text_n_model,text_n_token,text_n_onxx,choice],[gr.File(label="Download ONNX File")])
 
143
  #choice.change(fn=function_change, inputs=choice, outputs=label)
144
  return demo
145
  c=OnnxModelConverter()
 
5
  from VitsModelSplit.vits_model import VitsModel
6
  import gradio as gr
7
  import os
8
+ def create_file():
9
+ # مسار الملف المؤقت
10
+ file_path = "/tmp/gradio/test_model.onnx"
11
+
12
+ # إنشاء ملف ONNX تجريبي في حالة عدم وجوده
13
+ if not os.path.exists(file_path):
14
+ with open(file_path, "w") as file:
15
+ file.write("This is a test ONNX model file.")
16
+
17
+ # إرجاع مسار الملف حتى يمكن تنزيله
18
+ return file_path
19
  class OnnxModelConverter:
20
  def __init__(self):
21
  self.model = None
22
+ def download_txt():
23
+
24
  def download_file(self,file_path):
25
  if not os.path.exists(file_path):
26
  with open(file_path, "w") as file:
 
153
  btn=gr.Button("convert")
154
  label=gr.Label("return name model onxx")
155
  btn.click(self.convert,[text_n_model,text_n_token,text_n_onxx,choice],[gr.File(label="Download ONNX File")])
156
+ download_button = gr.File(create_file, label="Download ONNX File")
157
  #choice.change(fn=function_change, inputs=choice, outputs=label)
158
  return demo
159
  c=OnnxModelConverter()