peace4ever
commited on
Commit
•
e8e622a
1
Parent(s):
68414d8
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
3 |
-
# from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoConfig
|
4 |
from transformers import pipeline
|
5 |
|
6 |
model_name = "peace4ever/roberta-large-finetuned-mongolian_v3"
|
@@ -30,30 +29,3 @@ if text is not None:
|
|
30 |
# probability = predictions[0]["score"]
|
31 |
# col1.write(label)
|
32 |
# col2.write(f"{probability:.2f}")
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
# tokenizer = AutoTokenizer.from_pretrained(model_name)
|
37 |
-
# model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
38 |
-
|
39 |
-
#
|
40 |
-
# encoded_input = tokenizer(text, return_tensors="pt")
|
41 |
-
# output = model(**encoded_input)
|
42 |
-
|
43 |
-
# label_map = {"positive": 0, "negative": 1, "neutral": 2}
|
44 |
-
|
45 |
-
# # Update the model configuration with custom labels
|
46 |
-
# config = AutoConfig.from_pretrained(model_name)
|
47 |
-
# config.label2id = {"positive": 0, "negative": 1, "neutral": 2}
|
48 |
-
# config.id2label = {0: "positive", 1: "negative", 2: "neutral"}
|
49 |
-
# config.save_pretrained(model_name)
|
50 |
-
|
51 |
-
# predicted_label_id = torch.argmax(output.logits, dim=1).item()
|
52 |
-
# id2label = model.config.id2label
|
53 |
-
# predicted_label = id2label[predicted_label_id]
|
54 |
-
|
55 |
-
# print("Predicted Class:", predicted_label)
|
56 |
-
|
57 |
-
# st.json(predicted_label)
|
58 |
-
|
59 |
-
|
|
|
1 |
import streamlit as st
|
2 |
+
|
|
|
3 |
from transformers import pipeline
|
4 |
|
5 |
model_name = "peace4ever/roberta-large-finetuned-mongolian_v3"
|
|
|
29 |
# probability = predictions[0]["score"]
|
30 |
# col1.write(label)
|
31 |
# col2.write(f"{probability:.2f}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|