Jahmori commited on
Commit
7ca42a4
·
1 Parent(s): caf4dc3

fixed directory issues

Browse files
Files changed (1) hide show
  1. app.py +3 -13
app.py CHANGED
@@ -12,7 +12,6 @@ from speechbrain.utils.fetching import FetchConfig
12
  from pyannote.audio import Pipeline
13
  from pyannote.core import Segment, Annotation
14
  from transformers import pipeline, AutoModelForSpeechSeq2Seq, AutoProcessor
15
- from huggingface_hub import hffs
16
 
17
  # Process Outline
18
  # 1. Initialize ReSepformer model
@@ -35,7 +34,7 @@ torch.backends.cudnn.allow_tf32 = False
35
 
36
 
37
  token = os.environ.get("HF_TOKEN")
38
- model_path = hffs.ls("spaces/Jahmori-R/PureVoiceAISpace/pretrained_models",detail=False)
39
  temp_dir = tempfile.gettempdir()
40
 
41
 
@@ -53,7 +52,6 @@ def process_audio(mixture):
53
 
54
 
55
 
56
- return os.listdir("/home/user/app/pretrained_models/resepformer-librimix2spk")
57
  # ---------------------------------------------------------
58
  # INITIALIZE MODELS
59
  # ---------------------------------------------------------
@@ -62,7 +60,7 @@ def process_audio(mixture):
62
 
63
  #Loading Resepformer Model
64
  try:
65
- separator = SepformerSeparation.from_hparams(source="".join(model_path),hparams_file="hyperparams.yaml",run_opts={"device": "cuda"})
66
 
67
  # separator = SepformerSeparation.from_hparams(
68
  # source="Jahmori-R/resepformer-librimix2spk",
@@ -209,18 +207,10 @@ def process_audio(mixture):
209
 
210
  return spk_1, spk_2, log
211
 
212
- # demo = gr.Interface(
213
- # fn=process_audio,
214
- # inputs = gr.Audio(type="filepath", label = "Upload Mixture Audio"),
215
- # outputs = [gr.Audio(label="Speaker 1"),gr.Audio(label="Speaker 2"),gr.JSON(label="Logs")],
216
- # title="Test Demo", description = "Testing gradio with pipeline"
217
- # )
218
-
219
-
220
  demo = gr.Interface(
221
  fn=process_audio,
222
  inputs = gr.Audio(type="filepath", label = "Upload Mixture Audio"),
223
- outputs = [gr.Textbox()],
224
  title="Test Demo", description = "Testing gradio with pipeline"
225
  )
226
 
 
12
  from pyannote.audio import Pipeline
13
  from pyannote.core import Segment, Annotation
14
  from transformers import pipeline, AutoModelForSpeechSeq2Seq, AutoProcessor
 
15
 
16
  # Process Outline
17
  # 1. Initialize ReSepformer model
 
34
 
35
 
36
  token = os.environ.get("HF_TOKEN")
37
+ model_path = "/home/user/app/pretrained_models/resepformer-librimix2spk"
38
  temp_dir = tempfile.gettempdir()
39
 
40
 
 
52
 
53
 
54
 
 
55
  # ---------------------------------------------------------
56
  # INITIALIZE MODELS
57
  # ---------------------------------------------------------
 
60
 
61
  #Loading Resepformer Model
62
  try:
63
+ separator = SepformerSeparation.from_hparams(source=model_path,hparams_file="hyperparams.yaml",run_opts={"device": "cuda"})
64
 
65
  # separator = SepformerSeparation.from_hparams(
66
  # source="Jahmori-R/resepformer-librimix2spk",
 
207
 
208
  return spk_1, spk_2, log
209
 
 
 
 
 
 
 
 
 
210
  demo = gr.Interface(
211
  fn=process_audio,
212
  inputs = gr.Audio(type="filepath", label = "Upload Mixture Audio"),
213
+ outputs = [gr.Audio(label="Speaker 1"),gr.Audio(label="Speaker 2"),gr.JSON(label="Logs")],
214
  title="Test Demo", description = "Testing gradio with pipeline"
215
  )
216