Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,25 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
from transformers import AutoModel, pipeline, AutoTokenizer
|
4 |
|
5 |
-
access_token = "
|
6 |
|
7 |
-
model =
|
8 |
|
9 |
tokenizer = AutoTokenizer.from_pretrained(
|
10 |
-
"
|
|
|
11 |
use_fast=True,
|
12 |
add_prefix_space=True,
|
13 |
)
|
14 |
|
15 |
-
classifier = pipeline("text-classification",
|
16 |
padding=True, truncation=True, batch_size=1)
|
17 |
|
18 |
def prozesatu(testua):
|
19 |
-
|
20 |
-
|
|
|
21 |
|
22 |
prozesatu.classifier = classifier
|
23 |
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
from transformers import AutoModel, pipeline, AutoTokenizer, AutoModelForSequenceClassification
|
4 |
|
5 |
+
access_token = "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"
|
6 |
|
7 |
+
model = AutoModelForSequenceClassification.from_pretrained("EkhiAzur/RoBERTA_3", token=access_token)
|
8 |
|
9 |
tokenizer = AutoTokenizer.from_pretrained(
|
10 |
+
"EkhiAzur/RoBERTA_3",
|
11 |
+
token = access_token,
|
12 |
use_fast=True,
|
13 |
add_prefix_space=True,
|
14 |
)
|
15 |
|
16 |
+
classifier = pipeline("text-classification", tokenizer=tokenizer, model=model, max_length=512,
|
17 |
padding=True, truncation=True, batch_size=1)
|
18 |
|
19 |
def prozesatu(testua):
|
20 |
+
|
21 |
+
prediction = prozesatu.classifier(testua)[0]
|
22 |
+
return 'C1:{}. Probabilitatea:{:.2f}'.format(prediction["label"], round(prediction["score"], 2))
|
23 |
|
24 |
prozesatu.classifier = classifier
|
25 |
|