Spaces:
Sleeping
Sleeping
Add application
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ import torch
|
|
16 |
from deep_translator import DeeplTranslator
|
17 |
import torch
|
18 |
import torch.nn.functional as F
|
19 |
-
|
20 |
# Buraya İngilizce modelinizi yazın
|
21 |
model = AutoModelForSequenceClassification.from_pretrained("OsBaran/Roberta-Classification-Model")
|
22 |
tokenizer = AutoTokenizer.from_pretrained("roberta-base")
|
@@ -146,7 +146,7 @@ def sbert_similarity(input_text, bbc_articles):
|
|
146 |
print(f"En benzer haber skoru: {max_score:.2f}")
|
147 |
|
148 |
def translate_text(text, source_lang='tr', target_lang='en'):
|
149 |
-
translated = DeeplTranslator(api_key=
|
150 |
return translated
|
151 |
# Türkçe modelini yükle
|
152 |
# model_tr_name = "dbmdz/bert-base-turkish-cased" # Buraya Türkçe modelinizi yazın
|
|
|
16 |
from deep_translator import DeeplTranslator
|
17 |
import torch
|
18 |
import torch.nn.functional as F
|
19 |
+
api_key_deepl = "69f73328-5f95-4eda-813a-16af8c688404:fx"
|
20 |
# Buraya İngilizce modelinizi yazın
|
21 |
model = AutoModelForSequenceClassification.from_pretrained("OsBaran/Roberta-Classification-Model")
|
22 |
tokenizer = AutoTokenizer.from_pretrained("roberta-base")
|
|
|
146 |
print(f"En benzer haber skoru: {max_score:.2f}")
|
147 |
|
148 |
def translate_text(text, source_lang='tr', target_lang='en'):
|
149 |
+
translated = DeeplTranslator(api_key=api_key_deepl, source=source_lang, target=target_lang).translate(text)
|
150 |
return translated
|
151 |
# Türkçe modelini yükle
|
152 |
# model_tr_name = "dbmdz/bert-base-turkish-cased" # Buraya Türkçe modelinizi yazın
|