merve HF staff commited on
Commit
26bcd5f
1 Parent(s): b725902

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -7
app.py CHANGED
@@ -96,10 +96,14 @@ def categorize(input):
96
  return ttc(input)[0]["generated_text"]
97
 
98
  @spaces.GPU
99
- def turna(input, generation_params):
 
 
100
  turna = pipeline(model="boun-tabi-LMG/TURNA", device=0)
101
 
102
- return turna(input, **generation_params)[0]["generated_text"]
 
 
103
 
104
 
105
  with gr.Blocks(theme="abidlabs/Lime") as demo:
@@ -137,9 +141,9 @@ with gr.Blocks(theme="abidlabs/Lime") as demo:
137
  num_beams = gr.Slider(label = "Number of beams", minimum=1,
138
  maximum=10, value=3)
139
  do_sample = gr.Radio(choices = [True, False], value = True, label = "Sampling")
140
- generation_params = {"max_new_tokens":max_new_tokens, length_penalty:"length_penalty",
141
- "top_k": top_k, "top_p": top_p, "temp": temp, "num_beams": num_beams,
142
- "do_sample": do_sample}
143
  with gr.Row():
144
 
145
  text_gen_input = gr.Textbox(label="Text Generation Input")
@@ -159,8 +163,12 @@ with gr.Blocks(theme="abidlabs/Lime") as demo:
159
 
160
  text_submit = gr.Button()
161
  text_output = gr.Textbox(label="Text Categorization Output")
162
- text_submit.click(categorize, inputs=[text_input], outputs=text_output)
163
- text_examples = gr.Examples(examples = text_category_example, inputs = [text_input], outputs=text_output, fn=categorize)
 
 
 
 
164
 
165
 
166
  with gr.Tab("NLI"):
 
96
  return ttc(input)[0]["generated_text"]
97
 
98
  @spaces.GPU
99
+ def turna(input, max_new_tokens = max_new_tokens, length_penalty=length_penalty,
100
+ top_k=top_k, top_p=top_p, temperature=temp, num_beams=num_beams,
101
+ do_sample = do_sample):
102
  turna = pipeline(model="boun-tabi-LMG/TURNA", device=0)
103
 
104
+ return turna(input, max_new_tokens = max_new_tokens, length_penalty=length_penalty,
105
+ top_k=top_k, top_p=top_p, temperature=temp, num_beams=num_beams,
106
+ do_sample = do_sample)[0]["generated_text"]
107
 
108
 
109
  with gr.Blocks(theme="abidlabs/Lime") as demo:
 
141
  num_beams = gr.Slider(label = "Number of beams", minimum=1,
142
  maximum=10, value=3)
143
  do_sample = gr.Radio(choices = [True, False], value = True, label = "Sampling")
144
+ generation_params = [max_new_tokens, length_penalty,
145
+ top_k, top_p, temp, num_beams,
146
+ do_sample]
147
  with gr.Row():
148
 
149
  text_gen_input = gr.Textbox(label="Text Generation Input")
 
163
 
164
  text_submit = gr.Button()
165
  text_output = gr.Textbox(label="Text Categorization Output")
166
+ text_submit.click(categorize, inputs=[text_input, max_new_tokens, length_penalty,
167
+ top_k, top_p, temp, num_beams,
168
+ do_sample], outputs=text_output)
169
+ text_examples = gr.Examples(examples = text_category_example, inputs = [text_input, max_new_tokens, length_penalty,
170
+ top_k, top_p, temp, num_beams,
171
+ do_sample], outputs=text_output, fn=categorize)
172
 
173
 
174
  with gr.Tab("NLI"):