|
import gradio as gr |
|
from transformers import AutoModelForSequenceClassification, AutoTokenizer |
|
|
|
def processInput(input): |
|
|
|
model = AutoModelForSequenceClassification.from_pretrained("garrettbaber/twitter-roberta-base-fear-intensity") |
|
tokenizer = AutoTokenizer.from_pretrained("garrettbaber/twitter-roberta-base-fear-intensity") |
|
|
|
tokens = tokenizer(input, return_tensors="pt") |
|
|
|
outputs = model(**tokens) |
|
|
|
logits = outputs.get("logits") |
|
return logits.tolist() |
|
|
|
app = gr.Interface(fn=processInput, inputs="text", outputs="text") |
|
|
|
app.launch() |