HakshaySundar commited on
Commit
1d0d26c
1 Parent(s): 57c0869

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. text_converter.py +8 -0
app.py CHANGED
@@ -13,7 +13,7 @@ def convert_text_fre(input_text, grade_level, input_reading_score):
13
  output_text, similarity, reading_level, message = generate_sim_fre(input_text, min_level, max_level, MIN_ENTAILMENT, SYSTEM_PROMPT, MAX_ITER, float(input_reading_score))
14
  return output_text, similarity, reading_level, message
15
 
16
- def convert_text_sbert(input_text, grade_level, input_reading_score, is_fre):
17
  min_level, max_level = sbert_levels[grade_level]
18
  output_text, similarity, reading_level, message = generate_sim_sbert(input_text, min_level, max_level, MIN_ENTAILMENT, SYSTEM_PROMPT, MAX_ITER, float(input_reading_score))
19
  return output_text, similarity, reading_level, message
@@ -76,7 +76,7 @@ with gr.Blocks(css='styles.css') as app:
76
 
77
  convert_button.click(
78
  fn=convert_text_sbert,
79
- inputs=[input_text, grade_level_fre, output_input_reading_score],
80
  outputs=[output_converted_text, output_similarity, output_reading_level, output_message]
81
  )
82
 
 
13
  output_text, similarity, reading_level, message = generate_sim_fre(input_text, min_level, max_level, MIN_ENTAILMENT, SYSTEM_PROMPT, MAX_ITER, float(input_reading_score))
14
  return output_text, similarity, reading_level, message
15
 
16
+ def convert_text_sbert(input_text, grade_level, input_reading_score):
17
  min_level, max_level = sbert_levels[grade_level]
18
  output_text, similarity, reading_level, message = generate_sim_sbert(input_text, min_level, max_level, MIN_ENTAILMENT, SYSTEM_PROMPT, MAX_ITER, float(input_reading_score))
19
  return output_text, similarity, reading_level, message
 
76
 
77
  convert_button.click(
78
  fn=convert_text_sbert,
79
+ inputs=[input_text, grade_level_sbert, output_input_reading_score],
80
  outputs=[output_converted_text, output_similarity, output_reading_level, output_message]
81
  )
82
 
text_converter.py CHANGED
@@ -62,10 +62,18 @@ def __set_reading_levels(level_type):
62
 
63
  def fetch_readability_score_fre(input_text):
64
  __set_reading_levels(__model_types[0])
 
 
 
 
65
  return __user_input_readability_level(input_text, True)
66
 
67
  def fetch_readability_score_sbert(input_text):
68
  __set_reading_levels(__model_types[1])
 
 
 
 
69
  return __user_input_readability_level(input_text, False)
70
 
71
  def __user_input_readability_level(input_text, is_fre):
 
62
 
63
  def fetch_readability_score_fre(input_text):
64
  __set_reading_levels(__model_types[0])
65
+ print(f"=============== Setting Reading Levels to FRE ===============")
66
+ print(f"Reading Level Dictionary: {__reading_levels}\n")
67
+ print(f"Reading Level Dictionary: {__inverse_reading_levels}")
68
+ print(f"=============== Finished Setting Reading Levels to FRE ===============")
69
  return __user_input_readability_level(input_text, True)
70
 
71
  def fetch_readability_score_sbert(input_text):
72
  __set_reading_levels(__model_types[1])
73
+ print(f"=============== Setting Reading Levels to SBERT ===============")
74
+ print(f"Reading Level Dictionary: {__reading_levels}\n")
75
+ print(f"Reading Level Dictionary: {__inverse_reading_levels}")
76
+ print(f"=============== Finished Setting Reading Levels to SBERT ===============")
77
  return __user_input_readability_level(input_text, False)
78
 
79
  def __user_input_readability_level(input_text, is_fre):