Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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"
|
| 86 |
-
"
|
| 87 |
-
summary += f"
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
"
|
| 92 |
-
|
| 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
|