File size: 754 Bytes
1ab4362
 
c9c4e90
b2820ed
 
 
 
 
401411c
 
f1f799c
401411c
 
 
 
e07cb10
 
 
 
 
 
c9c4e90
 
e07cb10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr

from transformers import AutoModel, pipeline, AutoTokenizer

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

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

tokenizer = AutoTokenizer.from_pretrained(
  "ixa-ehu/roberta-eus-euscrawl-large-cased",
  use_fast=True,
  add_prefix_space=True,
)

classifier = pipeline("text-classification", model=model, tokenizer=tokenizer, 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"]}'

prozesatu.classifier = classifier

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