Spaces:
Sleeping
Sleeping
API Integration UI bugfix
Browse filesDynamic change of ui options was not working.
- app.py +6 -3
- text_converter.py +1 -0
app.py
CHANGED
@@ -18,12 +18,15 @@ with gr.Blocks(css='styles.css') as app:
|
|
18 |
|
19 |
with gr.Tab("Reading Level Calculator"):
|
20 |
with gr.Row():
|
21 |
-
model_select = gr.Radio(choices=model_types, label="Readability Score Model", value=model_types[1], interactive=True, scale=2)
|
22 |
model_select_btn = gr.Button("Select Readability Score Model", scale=1)
|
23 |
|
|
|
|
|
24 |
model_select_btn.click(
|
25 |
fn = set_reading_levels,
|
26 |
-
inputs=[model_select]
|
|
|
27 |
)
|
28 |
|
29 |
input_text = gr.Textbox(label="Input Text", placeholder="Type here...", lines=4)
|
@@ -39,7 +42,7 @@ with gr.Blocks(css='styles.css') as app:
|
|
39 |
outputs=[output_input_reading_score, output_input_reading_level]
|
40 |
)
|
41 |
|
42 |
-
grade_level = gr.Radio(choices=list(
|
43 |
|
44 |
output_reading_level = gr.Textbox(label="Output Reading Level", placeholder="Output Reading Level...", lines=1)
|
45 |
output_similarity = gr.Textbox(label="Similarity", placeholder="Similarity Score...", lines=1)
|
|
|
18 |
|
19 |
with gr.Tab("Reading Level Calculator"):
|
20 |
with gr.Row():
|
21 |
+
model_select = gr.Radio(choices=model_types, label="Readability Score Model", value=model_types[1], interactive=True, scale=2, change=True)
|
22 |
model_select_btn = gr.Button("Select Readability Score Model", scale=1)
|
23 |
|
24 |
+
option_reading_level = {}
|
25 |
+
|
26 |
model_select_btn.click(
|
27 |
fn = set_reading_levels,
|
28 |
+
inputs=[model_select],
|
29 |
+
outputs=[option_reading_level]
|
30 |
)
|
31 |
|
32 |
input_text = gr.Textbox(label="Input Text", placeholder="Type here...", lines=4)
|
|
|
42 |
outputs=[output_input_reading_score, output_input_reading_level]
|
43 |
)
|
44 |
|
45 |
+
grade_level = gr.Radio(choices=list(option_reading_level.keys()), label="Target Reading Level", value=list(option_reading_level.keys())[0], interactive=True)
|
46 |
|
47 |
output_reading_level = gr.Textbox(label="Output Reading Level", placeholder="Output Reading Level...", lines=1)
|
48 |
output_similarity = gr.Textbox(label="Similarity", placeholder="Similarity Score...", lines=1)
|
text_converter.py
CHANGED
@@ -62,6 +62,7 @@ def set_reading_levels(level_type):
|
|
62 |
reading_levels = sbert_levels
|
63 |
inverse_reading_levels = {v: k for k, v in reading_levels.items()}
|
64 |
model_type = level_type
|
|
|
65 |
|
66 |
def user_input_readability_level(input_text):
|
67 |
current_score = ping_api(input_text, model_type) #flesch_reading_ease(input_text)
|
|
|
62 |
reading_levels = sbert_levels
|
63 |
inverse_reading_levels = {v: k for k, v in reading_levels.items()}
|
64 |
model_type = level_type
|
65 |
+
return reading_levels
|
66 |
|
67 |
def user_input_readability_level(input_text):
|
68 |
current_score = ping_api(input_text, model_type) #flesch_reading_ease(input_text)
|