ssiidd commited on
Commit
9bc09f5
1 Parent(s): 2e91539

Fix s3prl installation

Browse files
Files changed (2) hide show
  1. app.py +11 -0
  2. s3prl.sh +6 -2
app.py CHANGED
@@ -7,10 +7,16 @@ from espnet2.bin.tts_inference import Text2Speech
7
  from espnet2.utils.types import str_or_none
8
  from espnet2.bin.asr_inference import Speech2Text
9
  from subprocess import call
 
10
 
11
  with open('s3prl.sh', 'rb') as file:
12
  script = file.read()
13
  rc = call(script, shell=True)
 
 
 
 
 
14
  # tagen = 'kan-bayashi/ljspeech_vits'
15
  # vocoder_tagen = "none"
16
 
@@ -42,6 +48,11 @@ def inference(wav,data):
42
  speech, rate = soundfile.read(wav.name)
43
  nbests = speech2text_fsc(speech)
44
  text, *_ = nbests[0]
 
 
 
 
 
45
  # if lang == "chinese":
46
  # wav = text2speechch(text)["wav"]
47
  # scipy.io.wavfile.write("out.wav",text2speechch.fs , wav.view(-1).cpu().numpy())
 
7
  from espnet2.utils.types import str_or_none
8
  from espnet2.bin.asr_inference import Speech2Text
9
  from subprocess import call
10
+ import os
11
 
12
  with open('s3prl.sh', 'rb') as file:
13
  script = file.read()
14
  rc = call(script, shell=True)
15
+ import sys
16
+ sys.path.append(os.getcwd()+"/s3prl")
17
+ os.environ["PYTHONPATH"]=os.getcwd()+"/s3prl"
18
+
19
+ # exit()
20
  # tagen = 'kan-bayashi/ljspeech_vits'
21
  # vocoder_tagen = "none"
22
 
 
48
  speech, rate = soundfile.read(wav.name)
49
  nbests = speech2text_fsc(speech)
50
  text, *_ = nbests[0]
51
+ intent=text.split(" ")[0]
52
+ action=intent.split("_")[0]
53
+ objects=intent.split("_")[1]
54
+ location=intent.split("_")[1]
55
+ text="{action: "+action+", object: "+objects+", location: "+location+"}"
56
  # if lang == "chinese":
57
  # wav = text2speechch(text)["wav"]
58
  # scipy.io.wavfile.write("out.wav",text2speechch.fs , wav.view(-1).cpu().numpy())
s3prl.sh CHANGED
@@ -1,3 +1,7 @@
1
  git clone https://github.com/s3prl/s3prl.git
2
- PYTHONPATH="${PYTHONPATH:-}:$(pwd)/s3prl"
3
- export PYTHONPATH
 
 
 
 
 
1
  git clone https://github.com/s3prl/s3prl.git
2
+ # rm -rf fairseq
3
+
4
+ # FairSeq Commit id when making this PR: `commit 313ff0581561c7725ea9430321d6af2901573dfb`
5
+ git clone --depth 1 https://github.com/pytorch/fairseq.git
6
+ python3 -m pip install --editable ./fairseq
7
+ python3 -m pip install filelock