HakshaySundar commited on
Commit
19aa03c
1 Parent(s): 90f11fe

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +10 -10
  2. text_converter.py +1 -1
app.py CHANGED
@@ -17,15 +17,9 @@ with gr.Blocks(css='styles.css') as app:
17
  gr.Markdown(APP_DESCRIPTION)
18
 
19
  with gr.Tab("Reading Level Calculator"):
20
- option_reading_level = {}
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
- outputs=[option_reading_level]
28
- )
29
 
30
  input_text = gr.Textbox(label="Input Text", placeholder="Type here...", lines=4)
31
 
@@ -40,7 +34,13 @@ with gr.Blocks(css='styles.css') as app:
40
  outputs=[output_input_reading_score, output_input_reading_level]
41
  )
42
 
43
- grade_level = gr.Radio(choices=list(option_reading_level.keys()), label="Target Reading Level", value=list(option_reading_level.keys())[0], interactive=True)
 
 
 
 
 
 
44
 
45
  output_reading_level = gr.Textbox(label="Output Reading Level", placeholder="Output Reading Level...", lines=1)
46
  output_similarity = gr.Textbox(label="Similarity", placeholder="Similarity Score...", lines=1)
 
17
  gr.Markdown(APP_DESCRIPTION)
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
  input_text = gr.Textbox(label="Input Text", placeholder="Type here...", lines=4)
25
 
 
34
  outputs=[output_input_reading_score, output_input_reading_level]
35
  )
36
 
37
+ grade_level = gr.Radio(label="Target Reading Level", interactive=True)
38
+
39
+ model_select_btn.click(
40
+ fn=set_reading_levels,
41
+ inputs=[model_select],
42
+ outputs=[grade_level]
43
+ )
44
 
45
  output_reading_level = gr.Textbox(label="Output Reading Level", placeholder="Output Reading Level...", lines=1)
46
  output_similarity = gr.Textbox(label="Similarity", placeholder="Similarity Score...", lines=1)
text_converter.py CHANGED
@@ -62,7 +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
- 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)
 
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.keys()
66
 
67
  def user_input_readability_level(input_text):
68
  current_score = ping_api(input_text, model_type) #flesch_reading_ease(input_text)