yirmibesogluz commited on
Commit
5daac23
1 Parent(s): 6c19101

Moved description within tab

Browse files
Files changed (1) hide show
  1. app.py +35 -33
app.py CHANGED
@@ -128,10 +128,12 @@ def turna(input, max_new_tokens, length_penalty,
128
 
129
 
130
  with gr.Blocks(theme="abidlabs/Lime") as demo:
 
131
  gr.Markdown("# TURNA")
132
  gr.Image("images/turna-logo.png", width=100, show_label=False, show_download_button=False, show_share_button=False)
133
 
134
- gr.Markdown(DESCRIPTION)
 
135
 
136
  with gr.Tab("Sentiment Analysis"):
137
  gr.Markdown("TURNA fine-tuned on sentiment analysis. Enter text to analyse sentiment and pick the model (tweets or product reviews).")
@@ -145,38 +147,6 @@ with gr.Blocks(theme="abidlabs/Lime") as demo:
145
  sentiment_output = gr.Textbox(label="Sentiment Analysis Output")
146
  sentiment_submit.click(sentiment_analysis, inputs=[sentiment_input, sentiment_choice], outputs=sentiment_output)
147
  sentiment_examples = gr.Examples(examples = sentiment_example, inputs = [sentiment_input, sentiment_choice], outputs=sentiment_output, fn=sentiment_analysis)
148
-
149
- with gr.Tab("TURNA 🐦"):
150
- gr.Markdown("Pre-trained TURNA. Enter text to start generating.")
151
- with gr.Column():
152
- with gr.Row():
153
- with gr.Column():
154
- with gr.Accordion("Advanced Generation Parameters"):
155
- max_new_tokens = gr.Slider(label = "Maximum length",
156
- minimum = 0,
157
- maximum = 512,
158
- value = 128)
159
- length_penalty = gr.Slider(label = "Length penalty",
160
- value=1.0)
161
- top_k = gr.Slider(label = "Top-k", value=10)
162
- top_p = gr.Slider(label = "Top-p", value=0.95)
163
- temp = gr.Slider(label = "Temperature", value=1.0, minimum=0.1, maximum=100.0)
164
- no_repeat_ngram_size =gr.Slider(label="No Repeat N-Gram Size", minimum=0,value=3,)
165
- repetition_penalty = gr.Slider(label = "Repetition Penalty", minimum=0.0, value=3.1, step=0.1)
166
- num_beams = gr.Slider(label = "Number of beams", minimum=1,
167
- maximum=10, value=3)
168
- do_sample = gr.Radio(choices = [True, False], value = True, label = "Sampling")
169
- with gr.Column():
170
- text_gen_input = gr.Textbox(label="Text Generation Input")
171
-
172
- text_gen_submit = gr.Button()
173
- text_gen_output = gr.Textbox(label="Text Generation Output")
174
- text_gen_submit.click(turna, inputs=[text_gen_input, max_new_tokens, length_penalty,
175
- top_k, top_p, temp, num_beams,
176
- do_sample, no_repeat_ngram_size, repetition_penalty], outputs=text_gen_output)
177
- text_gen_example = [["Bir varmış, bir yokmuş, evvel zaman içinde, kalbur saman içinde, uzak diyarların birinde bir turna"]]
178
- text_gen_examples = gr.Examples(examples = text_gen_example, inputs = [text_gen_input, max_new_tokens, length_penalty,
179
- top_k, top_p, temp, num_beams, do_sample, no_repeat_ngram_size, repetition_penalty], outputs=text_gen_output, fn=turna)
180
 
181
  with gr.Tab("Text Categorization"):
182
  gr.Markdown("TURNA fine-tuned on text categorization. Enter text to categorize text or try the example.")
@@ -265,6 +235,38 @@ with gr.Blocks(theme="abidlabs/Lime") as demo:
265
  sum_submit.click(summarize, inputs=[sum_input, sum_choice, max_new_tokens, length_penalty, no_repeat_ngram_size], outputs=sum_output)
266
  sum_examples = gr.Examples(examples = long_text, inputs = [sum_input, sum_choice, max_new_tokens, length_penalty, no_repeat_ngram_size], outputs=sum_output, fn=summarize)
267
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  gr.Markdown(CITATION)
269
 
270
  demo.launch()
 
128
 
129
 
130
  with gr.Blocks(theme="abidlabs/Lime") as demo:
131
+
132
  gr.Markdown("# TURNA")
133
  gr.Image("images/turna-logo.png", width=100, show_label=False, show_download_button=False, show_share_button=False)
134
 
135
+ with gr.Tab("TURNA 🐦"):
136
+ gr.Markdown(DESCRIPTION)
137
 
138
  with gr.Tab("Sentiment Analysis"):
139
  gr.Markdown("TURNA fine-tuned on sentiment analysis. Enter text to analyse sentiment and pick the model (tweets or product reviews).")
 
147
  sentiment_output = gr.Textbox(label="Sentiment Analysis Output")
148
  sentiment_submit.click(sentiment_analysis, inputs=[sentiment_input, sentiment_choice], outputs=sentiment_output)
149
  sentiment_examples = gr.Examples(examples = sentiment_example, inputs = [sentiment_input, sentiment_choice], outputs=sentiment_output, fn=sentiment_analysis)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
 
151
  with gr.Tab("Text Categorization"):
152
  gr.Markdown("TURNA fine-tuned on text categorization. Enter text to categorize text or try the example.")
 
235
  sum_submit.click(summarize, inputs=[sum_input, sum_choice, max_new_tokens, length_penalty, no_repeat_ngram_size], outputs=sum_output)
236
  sum_examples = gr.Examples(examples = long_text, inputs = [sum_input, sum_choice, max_new_tokens, length_penalty, no_repeat_ngram_size], outputs=sum_output, fn=summarize)
237
 
238
+ with gr.Tab("Text Generation"):
239
+ gr.Markdown("Pre-trained TURNA. Enter text to start generating.")
240
+ with gr.Column():
241
+ with gr.Row():
242
+ with gr.Column():
243
+ with gr.Accordion("Advanced Generation Parameters"):
244
+ max_new_tokens = gr.Slider(label = "Maximum length",
245
+ minimum = 0,
246
+ maximum = 512,
247
+ value = 128)
248
+ length_penalty = gr.Slider(label = "Length penalty",
249
+ value=1.0)
250
+ top_k = gr.Slider(label = "Top-k", value=10)
251
+ top_p = gr.Slider(label = "Top-p", value=0.95)
252
+ temp = gr.Slider(label = "Temperature", value=1.0, minimum=0.1, maximum=100.0)
253
+ no_repeat_ngram_size =gr.Slider(label="No Repeat N-Gram Size", minimum=0,value=3,)
254
+ repetition_penalty = gr.Slider(label = "Repetition Penalty", minimum=0.0, value=3.1, step=0.1)
255
+ num_beams = gr.Slider(label = "Number of beams", minimum=1,
256
+ maximum=10, value=3)
257
+ do_sample = gr.Radio(choices = [True, False], value = True, label = "Sampling")
258
+ with gr.Column():
259
+ text_gen_input = gr.Textbox(label="Text Generation Input")
260
+
261
+ text_gen_submit = gr.Button()
262
+ text_gen_output = gr.Textbox(label="Text Generation Output")
263
+ text_gen_submit.click(turna, inputs=[text_gen_input, max_new_tokens, length_penalty,
264
+ top_k, top_p, temp, num_beams,
265
+ do_sample, no_repeat_ngram_size, repetition_penalty], outputs=text_gen_output)
266
+ text_gen_example = [["Bir varmış, bir yokmuş, evvel zaman içinde, kalbur saman içinde, uzak diyarların birinde bir turna"]]
267
+ text_gen_examples = gr.Examples(examples = text_gen_example, inputs = [text_gen_input, max_new_tokens, length_penalty,
268
+ top_k, top_p, temp, num_beams, do_sample, no_repeat_ngram_size, repetition_penalty], outputs=text_gen_output, fn=turna)
269
+
270
  gr.Markdown(CITATION)
271
 
272
  demo.launch()