Danijel Petkovic commited on
Commit
9ee93b6
1 Parent(s): 3beb0e3
Files changed (1) hide show
  1. app.py +21 -20
app.py CHANGED
@@ -102,24 +102,25 @@ if question:
102
  unsafe_allow_html=True
103
  )
104
 
105
- with st.spinner("Generating an audio..."):
106
- audio_file = query_audio_tts({
107
- "inputs": question,
108
- "parameters": {
109
- "vocoder_tag": "str_or_none(none)",
110
- "threshold": 0.5,
111
- "minlenratio": 0.0,
112
- "maxlenratio": 10.0,
113
- "use_att_constraint": False,
114
- "backward_window": 1,
115
- "forward_window": 3,
116
- "speed_control_alpha": 1.0,
117
- "noise_scale": 0.333,
118
- "noise_scale_dur": 0.333
119
- }
120
- })
 
121
 
122
- with open("out.flac", "wb") as f:
123
- f.write(audio_file)
124
-
125
- st.audio("out.flac")
 
102
  unsafe_allow_html=True
103
  )
104
 
105
+ if generated_answer:
106
+ with st.spinner("Generating an audio..."):
107
+ audio_file = query_audio_tts({
108
+ "inputs": generated_answer,
109
+ "parameters": {
110
+ "vocoder_tag": "str_or_none(none)",
111
+ "threshold": 0.5,
112
+ "minlenratio": 0.0,
113
+ "maxlenratio": 10.0,
114
+ "use_att_constraint": False,
115
+ "backward_window": 1,
116
+ "forward_window": 3,
117
+ "speed_control_alpha": 1.0,
118
+ "noise_scale": 0.333,
119
+ "noise_scale_dur": 0.333
120
+ }
121
+ })
122
 
123
+ with open("out.flac", "wb") as f:
124
+ f.write(audio_file)
125
+
126
+ st.audio("out.flac")