File size: 549 Bytes
1ab4362
 
667dbfb
b2820ed
 
 
 
 
e07cb10
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr

from transformers import AutoModel, pipeline

access_token = "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"

model = AutoModel.from_pretrained("EkhiAzur/RoBERTA_3", token=access_token)

classifier = pipeline("text-classification", model=model, max_length=512,
                padding=True, truncation=True, batch_size=1)

def prozesatu(testua):
    prediction = prozesatu.classifier(testua)
    return f'C1:{prediction["label"]}. Probabilitatea:{prediction["score"]}'

gr.Interface(fn=prozesatu, inputs="text", outputs="text").launch()