Spaces:
Sleeping
Sleeping
Commit
•
e664527
1
Parent(s):
23812aa
Upload app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ def convert_text(input_text, grade_level, input_reading_score, model_type):
|
|
20 |
with gr.Blocks(css='styles.css') as app:
|
21 |
gr.Markdown(APP_DESCRIPTION)
|
22 |
|
23 |
-
with gr.Tab("
|
24 |
with gr.Row():
|
25 |
readability_model = gr.Radio(choices=model_types, label="Readability Model", value = model_types[0], interactive=True, scale = 2)
|
26 |
readability_model_btn = gr.Button("Set Readability Model", scale = 1)
|
@@ -35,8 +35,8 @@ with gr.Blocks(css='styles.css') as app:
|
|
35 |
input_text = gr.Textbox(label="Input Text", placeholder="Type here...", lines=4, scale = 2)
|
36 |
fetch_score_and_lvl_btn = gr.Button("Fetch Score and Level", scale = 1)
|
37 |
|
38 |
-
output_input_reading_score = gr.Textbox(label="Input Text Reading Score", placeholder="Input Text Reading Score...", lines=1)
|
39 |
-
output_input_reading_level = gr.Textbox(label="Input Text Reading Level", placeholder="Input Text Reading Level...", lines=1)
|
40 |
|
41 |
fetch_score_and_lvl_btn.click(
|
42 |
fn=user_input_readability_level,
|
@@ -44,11 +44,10 @@ with gr.Blocks(css='styles.css') as app:
|
|
44 |
outputs=[output_input_reading_score, output_input_reading_level]
|
45 |
)
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
#grade_level = gr.Radio(choices=list(fre_levels.keys()) if readability_model == model_types[0] else list(sbert_levels.keys()), label="Target Reading Level", interactive=True)
|
52 |
|
53 |
output_reading_level = gr.Textbox(label="Output Reading Level", placeholder="Output Reading Level...", lines=1)
|
54 |
output_similarity = gr.Textbox(label="Similarity", placeholder="Similarity Score...", lines=1)
|
@@ -60,7 +59,7 @@ with gr.Blocks(css='styles.css') as app:
|
|
60 |
|
61 |
convert_button.click(
|
62 |
fn=convert_text,
|
63 |
-
inputs=[input_text,
|
64 |
outputs=[output_converted_text, output_similarity, output_reading_level, output_message]
|
65 |
)
|
66 |
|
|
|
20 |
with gr.Blocks(css='styles.css') as app:
|
21 |
gr.Markdown(APP_DESCRIPTION)
|
22 |
|
23 |
+
with gr.Tab("Reading Level Converter"):
|
24 |
with gr.Row():
|
25 |
readability_model = gr.Radio(choices=model_types, label="Readability Model", value = model_types[0], interactive=True, scale = 2)
|
26 |
readability_model_btn = gr.Button("Set Readability Model", scale = 1)
|
|
|
35 |
input_text = gr.Textbox(label="Input Text", placeholder="Type here...", lines=4, scale = 2)
|
36 |
fetch_score_and_lvl_btn = gr.Button("Fetch Score and Level", scale = 1)
|
37 |
|
38 |
+
output_input_reading_score = gr.Textbox(label="Input Text Reading Score", placeholder="Input Text Reading Score...", lines=1, interactive=False)
|
39 |
+
output_input_reading_level = gr.Textbox(label="Input Text Reading Level", placeholder="Input Text Reading Level...", lines=1, interactive=False)
|
40 |
|
41 |
fetch_score_and_lvl_btn.click(
|
42 |
fn=user_input_readability_level,
|
|
|
44 |
outputs=[output_input_reading_score, output_input_reading_level]
|
45 |
)
|
46 |
|
47 |
+
|
48 |
+
grade_level_fre = gr.Radio(choices=list(fre_levels.keys()), label="Target Reading Level", interactive=True, visible=(readability_model == model_types[0]))
|
49 |
+
grade_level_sbert = gr.Radio(choices=list(sbert_levels.keys()), label="Target Reading Level", interactive=True, visible=(readability_model == model_types[1]))
|
50 |
+
#grade_level = gr.Radio(choices=list(fre_levels.keys()) if readability_model == model_types[0] else list(sbert_levels.keys()), label="Target Reading Level", interactive=True)
|
|
|
51 |
|
52 |
output_reading_level = gr.Textbox(label="Output Reading Level", placeholder="Output Reading Level...", lines=1)
|
53 |
output_similarity = gr.Textbox(label="Similarity", placeholder="Similarity Score...", lines=1)
|
|
|
59 |
|
60 |
convert_button.click(
|
61 |
fn=convert_text,
|
62 |
+
inputs=[input_text, grade_level_fre if (readability_model == model_types[0]) else grade_level_sbert, output_input_reading_score, readability_model],
|
63 |
outputs=[output_converted_text, output_similarity, output_reading_level, output_message]
|
64 |
)
|
65 |
|