Spaces:
Runtime error
Runtime error
Updating slider to dropdown
Browse files
app.py
CHANGED
|
@@ -409,11 +409,11 @@ def my_i_func(text):
|
|
| 409 |
def gen_syns(word, level):
|
| 410 |
with open('balanced_synonym_data.json') as f:
|
| 411 |
data = json.loads(f.read())
|
| 412 |
-
|
| 413 |
pins = wn_syns(word)
|
| 414 |
reko = []
|
| 415 |
for i in pins:
|
| 416 |
-
if i in data[level]:
|
| 417 |
reko.append(i)
|
| 418 |
str_reko = ""
|
| 419 |
for idx, i in enumerate(reko):
|
|
@@ -441,7 +441,7 @@ with gr.Blocks() as demo:
|
|
| 441 |
with gr.Group():
|
| 442 |
gr.Markdown("Reading Level Based Synonyms")
|
| 443 |
words = gr.Textbox(label="Word For Synonyms")
|
| 444 |
-
lvl = gr.
|
| 445 |
get_syns = gr.Button("Get Synonyms")
|
| 446 |
reccos = gr.Label()
|
| 447 |
|
|
|
|
| 409 |
def gen_syns(word, level):
|
| 410 |
with open('balanced_synonym_data.json') as f:
|
| 411 |
data = json.loads(f.read())
|
| 412 |
+
school_to_level = {"Elementary Level":'1', "Middle School Level":'2', "Highschool Level":'3', "College Level":'4'}
|
| 413 |
pins = wn_syns(word)
|
| 414 |
reko = []
|
| 415 |
for i in pins:
|
| 416 |
+
if i in data[school_to_level[level]]:
|
| 417 |
reko.append(i)
|
| 418 |
str_reko = ""
|
| 419 |
for idx, i in enumerate(reko):
|
|
|
|
| 441 |
with gr.Group():
|
| 442 |
gr.Markdown("Reading Level Based Synonyms")
|
| 443 |
words = gr.Textbox(label="Word For Synonyms")
|
| 444 |
+
lvl = gr.Dropdown(choices=["Elementary Level", "Middle School Level", "High School Level", "College Level" ], label="Intended Reading Level For Synonym")
|
| 445 |
get_syns = gr.Button("Get Synonyms")
|
| 446 |
reccos = gr.Label()
|
| 447 |
|