Spaces:
Runtime error
Runtime error
Add fairseq installation
Browse files
app.py
CHANGED
@@ -46,13 +46,19 @@ def inference(wav,data):
|
|
46 |
action=intent.split("_")[1]
|
47 |
text="{scenario: "+scenario+", action: "+action+"}"
|
48 |
elif data == "english_fsc":
|
|
|
49 |
speech, rate = soundfile.read(wav.name)
|
|
|
|
|
|
|
|
|
|
|
50 |
nbests = speech2text_fsc(speech)
|
51 |
text, *_ = nbests[0]
|
52 |
intent=text.split(" ")[0]
|
53 |
action=intent.split("_")[0]
|
54 |
objects=intent.split("_")[1]
|
55 |
-
location=intent.split("_")[
|
56 |
text="{action: "+action+", object: "+objects+", location: "+location+"}"
|
57 |
# if lang == "chinese":
|
58 |
# wav = text2speechch(text)["wav"]
|
|
|
46 |
action=intent.split("_")[1]
|
47 |
text="{scenario: "+scenario+", action: "+action+"}"
|
48 |
elif data == "english_fsc":
|
49 |
+
print(wav.name)
|
50 |
speech, rate = soundfile.read(wav.name)
|
51 |
+
print(speech.shape)
|
52 |
+
if len(speech.shape)==2:
|
53 |
+
speech=speech[:,0]
|
54 |
+
# soundfile.write("store_file.wav", speech, rate, subtype='FLOAT')
|
55 |
+
print(speech.shape)
|
56 |
nbests = speech2text_fsc(speech)
|
57 |
text, *_ = nbests[0]
|
58 |
intent=text.split(" ")[0]
|
59 |
action=intent.split("_")[0]
|
60 |
objects=intent.split("_")[1]
|
61 |
+
location=intent.split("_")[2]
|
62 |
text="{action: "+action+", object: "+objects+", location: "+location+"}"
|
63 |
# if lang == "chinese":
|
64 |
# wav = text2speechch(text)["wav"]
|