File size: 1,055 Bytes
dc12ba7
 
 
 
3bfdf10
dc12ba7
 
 
 
97be3c5
dc12ba7
 
fe37535
 
3bfdf10
fe37535
 
 
 
 
 
 
 
c78a869
fe37535
 
 
 
70d5693
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import gradio as gr

title = "Reformer"

description = "Gradio Demo for Reformer. To use it, simply add your text, or click one of the examples to load them. Read more at the links below."

article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2001.04451' target='_blank'>Reformer: The Efficient Transformer</a></p>"

examples = [
    ['A few months later','reformer-crime-and-punishment']
]

reformerc = gr.Interface.load("huggingface/google/reformer-crime-and-punishment")

#reformere = gr.Interface.load("huggingface/google/reformer-enwik8")

def inference(text,model):
    if model == "reformer-crime-and-punishment":
        outtext = reformerc(text)
    return outtext   

gr.Interface(
    inference, 
    [gr.inputs.Textbox(label="Input"),gr.inputs.Dropdown(choices=["reformer-crime-and-punishment"], type="value", default="reformer-crime-and-punishment", label="model")], 
    gr.outputs.Textbox(label="Output"),
    examples=examples,
    article=article,
    title=title,
    description=description).launch(enable_queue=True)