EkhiAzur's picture
Update app.py
f1f799c
raw
history blame
754 Bytes
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()