canahmet-29
commited on
Commit
•
b5a9227
1
Parent(s):
095c070
Update app.py
Browse files
app.py
CHANGED
@@ -60,20 +60,23 @@ elif input_method == "Dosya Yükle":
|
|
60 |
input_text = ""
|
61 |
|
62 |
@st.cache_resource
|
|
|
|
|
|
|
63 |
def load_pipeline(model_name, task_type):
|
64 |
-
if
|
65 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
66 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
67 |
return pipeline('text-classification', model=model, tokenizer=tokenizer)
|
68 |
-
elif
|
69 |
model = AutoModelForTokenClassification.from_pretrained(model_name)
|
70 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
71 |
return pipeline('ner', model=model, tokenizer=tokenizer)
|
72 |
-
elif
|
73 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
74 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
75 |
return pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
|
76 |
-
elif
|
77 |
model = AutoModelWithLMHead.from_pretrained(model_name)
|
78 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
79 |
return pipeline('text-generation', model=model, tokenizer=tokenizer)
|
|
|
60 |
input_text = ""
|
61 |
|
62 |
@st.cache_resource
|
63 |
+
task = st.sidebar.selectbox("Görev Seç", ['Metin Sınıflandırma', 'Metin Analizi', 'Duygu Analizi', 'Metin Oluşturma'])
|
64 |
+
|
65 |
+
|
66 |
def load_pipeline(model_name, task_type):
|
67 |
+
if task == "Metin Sınıflandırma":
|
68 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
69 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
70 |
return pipeline('text-classification', model=model, tokenizer=tokenizer)
|
71 |
+
elif task == "Metin Analizi":
|
72 |
model = AutoModelForTokenClassification.from_pretrained(model_name)
|
73 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
74 |
return pipeline('ner', model=model, tokenizer=tokenizer)
|
75 |
+
elif task == "Duygu Analizi":
|
76 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
77 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
78 |
return pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
|
79 |
+
elif task == "Metin Oluşturma":
|
80 |
model = AutoModelWithLMHead.from_pretrained(model_name)
|
81 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
82 |
return pipeline('text-generation', model=model, tokenizer=tokenizer)
|