Deevyankar commited on
Commit
8a3de45
Β·
verified Β·
1 Parent(s): 17240fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -27
app.py CHANGED
@@ -79,33 +79,17 @@ def compare_all(old_pdf, new_pdf, lo_file):
79
  transformer_sim = transformer_similarity(old_text, new_text)
80
  text_growth = (len(new_text) - len(old_text)) / len(old_text) * 100
81
 
82
- summary = f"πŸ“˜ **Summary of Comparison**
83
-
84
- "
85
- summary += f"πŸ“ˆ **TF-IDF Content Similarity**: {round(tfidf_sim * 100, 2)}%
86
- "
87
- summary += f"πŸ€– **Transformer-based Similarity**: {round(transformer_sim * 100, 2)}%
88
- "
89
- summary += f"πŸ“ **Text Growth**: {'+' if text_growth >= 0 else ''}{round(text_growth, 2)}% more content in new handout
90
-
91
- "
92
- summary += f"🎯 **LOs Matched (New β‰₯ 0.5)**: {sum(1 for s in new_scores if s >= 0.5)} of {len(los)}
93
- "
94
- summary += f"πŸ“Š **Insight**: New content appears {'more' if sum(new_scores) > sum(old_scores) else 'less'} aligned with outcomes.
95
- "
96
-
97
- explanation = (
98
- "
99
-
100
- ---
101
-
102
- "
103
- "πŸ“š **Explanation of Methods**:
104
- "
105
- "- **TF-IDF Similarity** checks how often important words appear in both documents. It gives a quick idea of textual overlap.
106
- "
107
- "- **Transformer Similarity** uses AI to understand meaning beyond words. It compares the 'sense' of the documents like a human would.
108
- "
109
  )
110
 
111
  return summary + explanation, df, fig, new_text
 
79
  transformer_sim = transformer_similarity(old_text, new_text)
80
  text_growth = (len(new_text) - len(old_text)) / len(old_text) * 100
81
 
82
+ summary = f"πŸ“˜ **Summary of Comparison**"
83
+ summary += f"πŸ“ˆ **TF-IDF Content Similarity**: {round(tfidf_sim * 100, 2)}%"
84
+ summary += f"πŸ€– **Transformer-based Similarity**: {round(transformer_sim * 100, 2)}%"
85
+ summary += f"πŸ“ **Text Growth**: {'+' if text_growth >= 0 else ''}{round(text_growth, 2)}% more content in new handout"
86
+ summary += f"🎯 **LOs Matched (New β‰₯ 0.5)**: {sum(1 for s in new_scores if s >= 0.5)} of {len(los)}"
87
+ summary += f"πŸ“Š **Insight**: New content appears {'more' if sum(new_scores) > sum(old_scores) else 'less'} aligned with outcomes."
88
+
89
+ explanation = ("---"
90
+ "πŸ“š **Explanation of Methods**:"
91
+ "- **TF-IDF Similarity** checks how often important words appear in both documents. It gives a quick idea of textual overlap."
92
+ "- **Transformer Similarity** uses AI to understand meaning beyond words. It compares the 'sense' of the documents like a human would."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  )
94
 
95
  return summary + explanation, df, fig, new_text