Sakil commited on
Commit
c5902e3
·
1 Parent(s): c57c6e8

Create app.py

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