younver commited on
Commit
b27f0f9
1 Parent(s): bbbb10c

try: loading model inside inference

Browse files
Files changed (1) hide show
  1. app.py +6 -16
app.py CHANGED
@@ -2,27 +2,17 @@ import os
2
  import gradio as gr
3
  import numpy as np
4
 
5
-
6
- io1 = gr.load("huggingface/facebook/xm_transformer_s2ut_en-hk")
7
- io2 = gr.load("huggingface/facebook/xm_transformer_s2ut_hk-en")
8
- io3 = gr.load("huggingface/facebook/xm_transformer_unity_en-hk")
9
- io4 = gr.load("huggingface/facebook/xm_transformer_unity_hk-en")
10
-
11
  def inference(audio, model):
12
- print(f"[DEBUG] audio: {audio}")
13
- print(f"[DEBUG] audio type: {type(audio)}")
14
- print(f"[DEBUG] model: {model}")
15
- out_audio = None
16
  if model == "xm_transformer_s2ut_en-hk":
17
- out_audio = io1(audio)
18
  elif model == "xm_transformer_s2ut_hk-en":
19
- out_audio = io2(audio)
20
  elif model == "xm_transformer_unity_en-hk":
21
- out_audio = io3(audio)
22
  else:
23
- out_audio = io4(audio)
24
- print(f"[DEBUG] out: {out_audio}")
25
- print(f"[DEBUG] out type: {type(out_audio)}")
26
  return out_audio
27
 
28
 
 
2
  import gradio as gr
3
  import numpy as np
4
 
 
 
 
 
 
 
5
  def inference(audio, model):
6
+ io = None
 
 
 
7
  if model == "xm_transformer_s2ut_en-hk":
8
+ io = gr.load("huggingface/facebook/xm_transformer_s2ut_en-hk")
9
  elif model == "xm_transformer_s2ut_hk-en":
10
+ io = gr.load("huggingface/facebook/xm_transformer_s2ut_hk-en")
11
  elif model == "xm_transformer_unity_en-hk":
12
+ io = gr.load("huggingface/facebook/xm_transformer_unity_en-hk")
13
  else:
14
+ io = gr.load("huggingface/facebook/xm_transformer_unity_hk-en")
15
+ out_audio = io(audio)
 
16
  return out_audio
17
 
18