Update app.py
Browse files
app.py
CHANGED
@@ -33,20 +33,20 @@ elif input_method == "Metin Yaz veya Yapıştır":
|
|
33 |
@st.cache_resource
|
34 |
def load_pipeline(model_name, task_type):
|
35 |
if task_type == "Metin Sınıflandırma":
|
36 |
-
model = AutoModelForSequenceClassification.from_pretrained(
|
37 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
38 |
return pipeline('text-classification', model=model, tokenizer=tokenizer)
|
39 |
elif task_type == "Metin Analizi":
|
40 |
-
model = AutoModelForTokenClassification.from_pretrained(
|
41 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
42 |
return pipeline('ner', model=model, tokenizer=tokenizer)
|
43 |
elif task_type == "Duygu Analizi":
|
44 |
-
model = AutoModelForSequenceClassification.from_pretrained(
|
45 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
46 |
return pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
|
47 |
elif task_type == "Metin Oluşturma":
|
48 |
-
model = AutoModelForCausalLM.from_pretrained(
|
49 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
50 |
return pipeline('text-generation', model=model, tokenizer=tokenizer)
|
51 |
|
52 |
# Görev ve modele göre pipeline yükleme
|
|
|
33 |
@st.cache_resource
|
34 |
def load_pipeline(model_name, task_type):
|
35 |
if task_type == "Metin Sınıflandırma":
|
36 |
+
model = AutoModelForSequenceClassification.from_pretrained("nlptown/bert-base-multilingual-uncased-sentiment")
|
37 |
+
tokenizer = AutoTokenizer.from_pretrained("nlptown/bert-base-multilingual-uncased-sentiment")
|
38 |
return pipeline('text-classification', model=model, tokenizer=tokenizer)
|
39 |
elif task_type == "Metin Analizi":
|
40 |
+
model = AutoModelForTokenClassification.from_pretrained("dbmdz/bert-base-turkish-cased")
|
41 |
+
tokenizer = AutoTokenizer.from_pretrained("dbmdz/bert-base-turkish-cased")
|
42 |
return pipeline('ner', model=model, tokenizer=tokenizer)
|
43 |
elif task_type == "Duygu Analizi":
|
44 |
+
model = AutoModelForSequenceClassification.from_pretrained("cardiffnlp/twitter-roberta-base-sentiment")
|
45 |
+
tokenizer = AutoTokenizer.from_pretrained("cardiffnlp/twitter-roberta-base-sentiment")
|
46 |
return pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
|
47 |
elif task_type == "Metin Oluşturma":
|
48 |
+
model = AutoModelForCausalLM.from_pretrained("gpt2")
|
49 |
+
tokenizer = AutoTokenizer.from_pretrained("gpt2")
|
50 |
return pipeline('text-generation', model=model, tokenizer=tokenizer)
|
51 |
|
52 |
# Görev ve modele göre pipeline yükleme
|