Ahsen Khaliq commited on
Commit
fe37535
1 Parent(s): dc12ba7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -2
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
 
3
  title = "Reformer"
4
 
5
- description = "Gradio Demo for Reformer Model trained on 'Crime and Punishment'. To use it, simply add your text, or click one of the examples to load them. Read more at the links below."
6
 
7
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2001.04451' target='_blank'>Reformer: The Efficient Transformer</a></p>"
8
 
@@ -10,4 +10,23 @@ examples = [
10
  ['A few months later']
11
  ]
12
 
13
- gr.Interface.load("huggingface/google/reformer-crime-and-punishment", inputs=gr.inputs.Textbox(lines=5, label="Input Text"),title=title,description=description,article=article, examples=examples).launch(enable_queue=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  title = "Reformer"
4
 
5
+ 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."
6
 
7
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2001.04451' target='_blank'>Reformer: The Efficient Transformer</a></p>"
8
 
 
10
  ['A few months later']
11
  ]
12
 
13
+ reformerc = gr.Interface.load("huggingface/google/reformer-crime-and-punishment")
14
+
15
+ reformere = gr.Interface.load("huggingface/google/reformer-enwik8")
16
+
17
+ def inference(text,model):
18
+ if model == "reformer-crime-and-punishment":
19
+ outtext = reformerc(text)
20
+ else:
21
+ outtext = reformere(text)
22
+ return outtext
23
+
24
+ gr.Interface(
25
+ inference,
26
+ [gr.inputs.Textbox(label="Input"),gr.inputs.Dropdown(choices=["reformer-crime-and-punishment","reformer-enwik8"], type="value", default="reformer-enwik8", label="model")
27
+ ],
28
+ gr.outputs.Textbox(label="Output"),
29
+ examples=examples,
30
+ article=article,
31
+ title=title,
32
+ description=description).launch(enable_queue=True, cache_examples=True)