Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline, AutoTokenizer
|
3 |
from sentence_transformers import SentenceTransformer, util
|
|
|
|
|
|
|
4 |
|
5 |
# Translation models
|
6 |
translation_models = {
|
@@ -25,7 +28,7 @@ def get_translator(language):
|
|
25 |
# Helper function to generate bullet points
|
26 |
def generate_bullet_points(text):
|
27 |
model = SentenceTransformer('paraphrase-MiniLM-L6-v2')
|
28 |
-
sentences = text
|
29 |
embeddings = model.encode(sentences, convert_to_tensor=True)
|
30 |
clusters = util.community_detection(embeddings, threshold=0.75)
|
31 |
|
@@ -109,3 +112,4 @@ iface.launch()
|
|
109 |
|
110 |
|
111 |
|
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline, AutoTokenizer
|
3 |
from sentence_transformers import SentenceTransformer, util
|
4 |
+
import nltk
|
5 |
+
nltk.download('punkt')
|
6 |
+
from nltk.tokenize import sent_tokenize
|
7 |
|
8 |
# Translation models
|
9 |
translation_models = {
|
|
|
28 |
# Helper function to generate bullet points
|
29 |
def generate_bullet_points(text):
|
30 |
model = SentenceTransformer('paraphrase-MiniLM-L6-v2')
|
31 |
+
sentences = sent_tokenize(text)
|
32 |
embeddings = model.encode(sentences, convert_to_tensor=True)
|
33 |
clusters = util.community_detection(embeddings, threshold=0.75)
|
34 |
|
|
|
112 |
|
113 |
|
114 |
|
115 |
+
|