from textblob import TextBlob import gradio as gr def get_nouns(text): blob = TextBlob(text) print(blob.tags) # [('The', 'DT'), ('titular', 'JJ'), # ('threat', 'NN'), ('of', 'IN'), ...] print(blob.parse()) print(blob.noun_phrases) # WordList(['titular threat', 'blob', # 'ultimate movie monster', # 'amoeba-like mass', ...]) for sentence in blob.sentences: print(sentence) with gr.Blocks() as app: with gr.Row(): with gr.Column(scale=3): inp = gr.Textbox(lines=10) btn = gr.Button() with gr.Column(scale=1): nouns=gr.Textbox(label="Nouns") btn.click(get_nouns,inp,nouns) app.launch()