merve HF Staff commited on
Commit
f612201
·
verified ·
1 Parent(s): b4a44ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -98,12 +98,12 @@ def categorize(input):
98
  @spaces.GPU
99
  def turna(input, max_new_tokens, length_penalty,
100
  top_k, top_p, temp, num_beams,
101
- do_sample, no_repeat_ngram_size):
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, no_repeat_ngram_size=no_repeat_ngram_size)[0]["generated_text"]
107
 
108
 
109
  with gr.Blocks(theme="abidlabs/Lime") as demo:
@@ -150,10 +150,10 @@ with gr.Blocks(theme="abidlabs/Lime") as demo:
150
  text_gen_output = gr.Textbox(label="Text Generation Output")
151
  text_gen_submit.click(turna, inputs=[text_gen_input, max_new_tokens, length_penalty,
152
  top_k, top_p, temp, num_beams,
153
- do_sample, no_repeat_ngram_size], outputs=text_gen_output)
154
  text_gen_example = [["Bir varmış, bir yokmuş, evvel zaman içinde, kalbur saman içinde, uzak diyarların birinde bir turna"]]
155
  text_gen_examples = gr.Examples(examples = text_gen_example, inputs = [text_gen_input, max_new_tokens, length_penalty,
156
- top_k, top_p, temp, num_beams, do_sample, no_repeat_ngram_size], outputs=text_gen_output, fn=turna)
157
 
158
  with gr.Tab("Text Categorization"):
159
  gr.Markdown("TURNA fine-tuned on text categorization. Enter text to categorize text or try the example.")
 
98
  @spaces.GPU
99
  def turna(input, max_new_tokens, length_penalty,
100
  top_k, top_p, temp, num_beams,
101
+ do_sample, no_repeat_ngram_size, repetition_penalty):
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, no_repeat_ngram_size=no_repeat_ngram_size, repetition_penalty)[0]["generated_text"]
107
 
108
 
109
  with gr.Blocks(theme="abidlabs/Lime") as demo:
 
150
  text_gen_output = gr.Textbox(label="Text Generation Output")
151
  text_gen_submit.click(turna, inputs=[text_gen_input, max_new_tokens, length_penalty,
152
  top_k, top_p, temp, num_beams,
153
+ do_sample, no_repeat_ngram_size, repetition_penalty], outputs=text_gen_output)
154
  text_gen_example = [["Bir varmış, bir yokmuş, evvel zaman içinde, kalbur saman içinde, uzak diyarların birinde bir turna"]]
155
  text_gen_examples = gr.Examples(examples = text_gen_example, inputs = [text_gen_input, max_new_tokens, length_penalty,
156
+ top_k, top_p, temp, num_beams, do_sample, no_repeat_ngram_size, repetition_penalty], outputs=text_gen_output, fn=turna)
157
 
158
  with gr.Tab("Text Categorization"):
159
  gr.Markdown("TURNA fine-tuned on text categorization. Enter text to categorize text or try the example.")