File size: 791 Bytes
1188681
d00a958
23610b0
d00a958
 
 
 
 
 
 
 
 
a1855ac
 
 
 
 
d00a958
a1855ac
 
 
 
 
 
 
d00a958
 
23610b0
 
bbadfc1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import gradio as gr
from transformers import pipeline

# Sentiment Analysis
sentiment = pipeline("sentiment-analysis")

def get_sentiment(input_text):
    return sentiment(input_text)

iface_sentiment = gr.Interface(get_sentiment, inputs="text", outputs="text", title="Sentiment Analysis")

# Text to Speech Translation
tts_title = "Text to Speech Translation"
tts_examples = [
    "I love learning machine learning",
    "How do you do?",
]

tts_demo = gr.Interface.load(
    "huggingface/facebook/fastspeech2-en-ljspeech",
    title=tts_title,
    examples=tts_examples,
    description="Give me something to say!",
)

# Launching both interfaces
demo = gr.TabbedInterface([iface_sentiment, tts_demo], ["Sentiment Analysis", "Text to Speech"])

if __name__ == "__main__":
    demo.launch()