File size: 460 Bytes
83d0a05
a967e1a
 
 
 
 
 
 
 
 
 
 
 
 
83d0a05
a967e1a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
#gr.Interface.load("models/hipnologo/gpt2-imdb-finetune").launch()
import gradio as gr

def postprocess_label(label):
    if label == "LABEL_0":
        return "Negative"
    elif label == "LABEL_1":
        return "Positive"
    else:
        return "Unknown label"

iface = gr.Interface.load("models/hipnologo/gpt2-imdb-finetune")
iface.update(outputs=gr.outputs.Textbox(label="Sentiment", postprocess=postprocess_label))

iface.launch()