akhaliq HF staff commited on
Commit
0c1789a
1 Parent(s): 9fee7d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -2
app.py CHANGED
@@ -6,7 +6,28 @@ description = "Gradio Demo for Tiny CTRL. To use it, simply add your text, or cl
6
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1909.05858' target='_blank'>CTRL: A Conditional Transformer Language Model for Controllable Generation</a></p>"
7
 
8
  examples = [
9
- ['My name is Thomas and my main']
10
  ]
11
 
12
- gr.Interface.load("huggingface/sshleifer/tiny-ctrl", inputs=gr.inputs.Textbox(lines=5, label="Input Text"),title=title,description=description,article=article, examples=examples).launch(enable_queue=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1909.05858' target='_blank'>CTRL: A Conditional Transformer Language Model for Controllable Generation</a></p>"
7
 
8
  examples = [
9
+ ['My name is Thomas and my main',"tiny-ctrl"]
10
  ]
11
 
12
+
13
+ io1 = gr.Interface.load("huggingface/sshleifer/tiny-ctrl")
14
+
15
+ io2 = gr.Interface.load("huggingface/prajjwal1/ctrl_discovery_flipped_2")
16
+
17
+
18
+ def inference(inputtext, model):
19
+ if model == "tiny-ctrl":
20
+ outlabel = io1(inputtext)
21
+ else:
22
+ outlabel = io2(inputtext)
23
+ return outlabel
24
+
25
+
26
+ gr.Interface(
27
+ inference,
28
+ [gr.inputs.Textbox(label="Context",lines=10),gr.inputs.Dropdown(choices=["tiny-ctrl","ctrl_discovery_flipped_2"], type="value", default="tiny-ctrl", label="model")],
29
+ [gr.outputs.Textbox(label="Output")],
30
+ examples=examples,
31
+ article=article,
32
+ title=title,
33
+ description=description).launch(enable_queue=True,cache_examples=True)