ihsan66 commited on
Commit
32f8762
1 Parent(s): f3452ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
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(model_name)
37
- tokenizer = AutoTokenizer.from_pretrained(model_name)
38
  return pipeline('text-classification', model=model, tokenizer=tokenizer)
39
  elif task_type == "Metin Analizi":
40
- model = AutoModelForTokenClassification.from_pretrained(model_name)
41
- tokenizer = AutoTokenizer.from_pretrained(model_name)
42
  return pipeline('ner', model=model, tokenizer=tokenizer)
43
  elif task_type == "Duygu Analizi":
44
- model = AutoModelForSequenceClassification.from_pretrained(model_name)
45
- tokenizer = AutoTokenizer.from_pretrained(model_name)
46
  return pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
47
  elif task_type == "Metin Oluşturma":
48
- model = AutoModelForCausalLM.from_pretrained(model_name)
49
- tokenizer = AutoTokenizer.from_pretrained(model_name)
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