Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -68,16 +68,23 @@ def get_nouns(text):
|
|
68 |
# 'ultimate movie monster',
|
69 |
# 'amoeba-like mass', ...])
|
70 |
return json_object,noun_list
|
71 |
-
|
|
|
|
|
72 |
|
73 |
with gr.Blocks() as app:
|
74 |
-
inp = gr.Textbox(lines=10)
|
75 |
-
btn = gr.Button()
|
|
|
|
|
|
|
|
|
76 |
with gr.Row():
|
77 |
with gr.Column(scale=2):
|
78 |
sen=gr.JSON(label="Sentences")
|
79 |
with gr.Column(scale=1):
|
80 |
nouns=gr.JSON(label="Nouns")
|
|
|
81 |
btn.click(get_nouns,inp,[sen,nouns])
|
82 |
app.launch()
|
83 |
|
|
|
68 |
# 'ultimate movie monster',
|
69 |
# 'amoeba-like mass', ...])
|
70 |
return json_object,noun_list
|
71 |
+
def find_query(query,sen,nouns):
|
72 |
+
blob_f = TextBlob(query)
|
73 |
+
return blob_f.parse()
|
74 |
|
75 |
with gr.Blocks() as app:
|
76 |
+
inp = gr.Textbox(label="Paste Text",lines=10)
|
77 |
+
btn = gr.Button("Load Document")
|
78 |
+
with gr.Row():
|
79 |
+
query=gr.Textbox(label="Search query")
|
80 |
+
search_btn=gr.Button("Search")
|
81 |
+
out_box=gr.Textbox(label="Results")
|
82 |
with gr.Row():
|
83 |
with gr.Column(scale=2):
|
84 |
sen=gr.JSON(label="Sentences")
|
85 |
with gr.Column(scale=1):
|
86 |
nouns=gr.JSON(label="Nouns")
|
87 |
+
search_btn.click(find_query,[query,sen,nouns],out_box)
|
88 |
btn.click(get_nouns,inp,[sen,nouns])
|
89 |
app.launch()
|
90 |
|