Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -217,36 +217,30 @@ def function(Textbox, Textbox2, Textbox3, Dropdown):
|
|
217 |
}
|
218 |
)
|
219 |
output = output["audio_out"]
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
# return mp3_data.read()
|
225 |
except Exception as e:
|
226 |
print(traceback.format_exc())
|
227 |
return "Please Wait!"
|
228 |
else:
|
229 |
return "Failed"
|
230 |
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
iface = gr.Interface(fn=function, inputs=inputs, outputs=outputs)
|
248 |
-
|
249 |
-
iface.launch()
|
250 |
|
251 |
|
252 |
|
|
|
217 |
}
|
218 |
)
|
219 |
output = output["audio_out"]
|
220 |
+
mp3_data = BytesIO()
|
221 |
+
output.export(mp3_data, format="mp3")
|
222 |
+
mp3_data.seek(0)
|
223 |
+
return mp3_data.read()
|
|
|
224 |
except Exception as e:
|
225 |
print(traceback.format_exc())
|
226 |
return "Please Wait!"
|
227 |
else:
|
228 |
return "Failed"
|
229 |
|
230 |
+
inputs = [
|
231 |
+
gr.inputs.Textbox(label="Textbox", type="text"),
|
232 |
+
gr.inputs.Textbox(label="Textbox2", type="text"),
|
233 |
+
gr.inputs.Textbox(label="Textbox3", type="password"),
|
234 |
+
gr.inputs.Dropdown(["Option1", "Option2"], label="Dropdown")
|
235 |
+
|
236 |
+
]
|
237 |
+
|
238 |
+
# outputs = gr.outputs.Image(type="numpy")
|
239 |
+
outputs = gr.outputs.Audio(type="filepath")
|
240 |
+
|
241 |
+
iface = gr.Interface(fn=function, inputs=inputs, outputs=outputs)
|
242 |
+
|
243 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
|
246 |
|