import gradio as gr from transformers import pipeline classifier = pipeline('sentiment-analysis') ################################################################# #1: Text to Speech 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 = title, examples=tts_examples, description="Give me something to say!", ) ################################################################# #2: Sentiment Analysis def get_sentiment(input_text): return classifier(input_text) sentiment_demo= gr.Interface(fn=get_sentiment, inputs = 'text',outputs=['text'],title = 'Sentiment Analysis', description = "Enter a sentence and know about it's sentiment",examples = [ ["We are very happy to show you the 🤗 Transformers library."], ["I am happy with the performance of Indian Hockey team"], ["Pizza was not at all hot and restaurant was having the pathetic service"] ]) #sentiment_demo.launch(inline = False) ################################################################# #3 POS Tagging import nltk nltk.download('punkt') nltk.download('averaged_perceptron_tagger') def get_POS(input_text): sent_tag = nltk.word_tokenize(input_text) for token in sent_tag: return nltk.pos_tag([token]) title = 'Know about Parts of Speech (POS) Tags' examples = [ ["We are very happy to show you the 🤗 Transformers library."], ["I am happy with the performance of Indian Hockey team"], ["Pizza was not at all hot and restaurant was having the pathetic service"] ] POS_demo = gr.Interface(fn=get_POS, inputs = 'text',outputs=['text'],title = title,description = 'Get POS tags',examples = examples) #POS_demo.launch(debug=True) ################################################################# #4 Language Translation from language_translation import translation_demo ################################################################# #5: Gradio ASR from SpeechTranscription_ASR import ST_ASR_demo ################################################################# #6 YouTube to Text Script generation from Text_Script_from_YouTube import textScript_demo ######################################################################################################## demo = gr.TabbedInterface([tts_demo, sentiment_demo, POS_demo, translation_demo, ST_ASR_demo, textScript_demo], ["Text to speech","Sentiment Analysis","POS findings", "Language Translation","ASR", "Get Text Script from YouTube video"]) if __name__ == "__main__": demo.launch()