File size: 754 Bytes
e74b5ef
f7d01d2
 
 
 
 
 
 
e74b5ef
cce88ae
f7d01d2
cce88ae
f7d01d2
 
 
69703e7
f7d01d2
6a2f335
e74b5ef
 
f7d01d2
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
from transformers import pipeline
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

tokenizer = AutoTokenizer.from_pretrained("FuriouslyAsleep/unhappyZebra100")

model = AutoModelForSequenceClassification.from_pretrained("FuriouslyAsleep/unhappyZebra100")

def greet(Doc_Passage_To_Test):

    inputs = tokenizer(Doc_Passage_To_Test, return_tensors="pt")
    outputs = model(**inputs)
    
    predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
    #print(predictions)    
#    return "Hello " + name + "!!"
    return "Probabilities are listed here (False prob, then True prob): " + str(predictions)

iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()