Omnibus commited on
Commit
0d3b770
1 Parent(s): 208bffe

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from textblob import TextBlob
2
+ import gradio as gr
3
+
4
+ def get_nouns(text):
5
+ blob = TextBlob(text)
6
+ print(blob.tags) # [('The', 'DT'), ('titular', 'JJ'),
7
+ # ('threat', 'NN'), ('of', 'IN'), ...]
8
+ print(blob.parse())
9
+ print(blob.noun_phrases) # WordList(['titular threat', 'blob',
10
+ # 'ultimate movie monster',
11
+ # 'amoeba-like mass', ...])
12
+ for sentence in blob.sentences:
13
+ print(sentence)
14
+
15
+
16
+ with gr.Blocks() as app:
17
+ with gr.Row():
18
+ with gr.Column(scale=3):
19
+ inp = gr.Textbox(lines=10)
20
+ btn = gr.Button()
21
+ with gr.Column(scale=1):
22
+ nouns=gr.Textbox(label="Nouns")
23
+ btn.click(get_nouns,inp,nouns)
24
+ app.launch()
25
+