Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import AutoTokenizer, AutoModelForSequenceClassification | |
import torch | |
pretrained = "rohanphadke/roberta-finetuned-triplebottomline" | |
tokenizer = AutoTokenizer.from_pretrained(pretrained) | |
model = AutoModelForSequenceClassification.from_pretrained(pretrained) | |
threshold = 0.5 | |
labels = {0: 'people', 1: 'planet', 2:'profit'} | |
return_labels = {'people': 0.25, 'planet':0.5, 'profit':0.75} | |
def greet(name): | |
return "Hello " + name + "!!" | |
def predict_text(text): | |
return return_labels | |
demo = gr.Interface(fn=predict_text, inputs="text", outputs="label") | |
demo.launch() |