File size: 608 Bytes
ea38205
1677649
3dde170
1677649
 
 
 
b8f48f7
 
 
88318eb
ea38205
 
 
 
b8f48f7
88318eb
b8f48f7
88318eb
ea38205
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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()