Spaces:
Runtime error
Runtime error
Create new file
Browse files
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
fastspeech = gr.Interface.load("huggingface/facebook/fastspeech2-en-ljspeech")
|
4 |
+
clip = gr.Interface.load("spaces/DrishtiSharma/Text-to-Image-search-using-CLIP")
|
5 |
+
|
6 |
+
|
7 |
+
def text2speech(text):
|
8 |
+
return fastspeech(text)
|
9 |
+
|
10 |
+
|
11 |
+
def text2image(text):
|
12 |
+
image = clip(text)[0]
|
13 |
+
return gr.processing_utils.decode_base64_to_image(image)
|
14 |
+
|
15 |
+
|
16 |
+
block = gr.Blocks()
|
17 |
+
|
18 |
+
with block:
|
19 |
+
text = gr.inputs.Textbox(placeholder="Try writing something..")
|
20 |
+
|
21 |
+
with gr.Column():
|
22 |
+
with gr.Row():
|
23 |
+
get_audio = gr.Button("generate audio")
|
24 |
+
get_image = gr.Button("generate image")
|
25 |
+
with gr.Row():
|
26 |
+
speech = gr.outputs.Audio()
|
27 |
+
image = gr.outputs.Image()
|
28 |
+
|
29 |
+
|
30 |
+
get_audio.click(text2speech, inputs=text, outputs=speech)
|
31 |
+
get_image.click(text2image, inputs=text, outputs=image)
|
32 |
+
|
33 |
+
block.launch()
|