Spaces:
Runtime error
Runtime error
from transformers import pipeline, LongformerForSequenceClassification, LongformerTokenizer, Trainer | |
import gradio as gr | |
def predict_fn(text: str) -> str: | |
model = LongformerForSequenceClassification.from_pretrained("model") | |
tokenizer = LongformerTokenizer.from_pretrained("allenai/longformer-base-4096") | |
p = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer) | |
return p(text)[0]["label"] | |
gr.Interface(predict_fn, "textbox", "label").launch() | |