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()