Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,7 @@ tokenizer1 = RobertaTokenizer.from_pretrained('roberta-base')
|
|
13 |
model1 = RobertaModel.from_pretrained('roberta-base')
|
14 |
#pipe = pipeline("text-classification", model="thugCodeNinja/robertatemp")
|
15 |
pipe = pipeline("text-classification",model=model,tokenizer=tokenizer)
|
|
|
16 |
def process_text(input_text):
|
17 |
if input_text:
|
18 |
text = input_text
|
@@ -71,7 +72,7 @@ def process_text(input_text):
|
|
71 |
if similarity > threshold:
|
72 |
similar_articles.append({'Link': link, 'Similarity': similarity})
|
73 |
similar_articles = sorted(similar_articles, key=lambda x: x['Similarity'], reverse=True)
|
74 |
-
|
75 |
return similar_articles[:5]
|
76 |
|
77 |
# prediction = pipe([text])
|
|
|
13 |
model1 = RobertaModel.from_pretrained('roberta-base')
|
14 |
#pipe = pipeline("text-classification", model="thugCodeNinja/robertatemp")
|
15 |
pipe = pipeline("text-classification",model=model,tokenizer=tokenizer)
|
16 |
+
threshold = 0.5
|
17 |
def process_text(input_text):
|
18 |
if input_text:
|
19 |
text = input_text
|
|
|
72 |
if similarity > threshold:
|
73 |
similar_articles.append({'Link': link, 'Similarity': similarity})
|
74 |
similar_articles = sorted(similar_articles, key=lambda x: x['Similarity'], reverse=True)
|
75 |
+
# Adjust the threshold as needed
|
76 |
return similar_articles[:5]
|
77 |
|
78 |
# prediction = pipe([text])
|