merve HF staff commited on
Commit
123980d
1 Parent(s): 0be38ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -22,7 +22,7 @@ long_text = [["Eyfel Kulesi (Fransızca: La tour Eiffel [la tuʀ ɛˈfɛl]), Par
22
  ner_example = [["Benim adım Turna."]]
23
  t2t_example = [["Paraphrase: Bu üründen çok memnun kaldım."]]
24
  nli_example = [["Bunu çok beğendim. Bunu çok sevdim."]]
25
-
26
 
27
 
28
 
@@ -89,9 +89,13 @@ def summarize(input, model_choice="turna_summarization_tr_news"):
89
  summarization_model = pipeline(model="boun-tabi-LMG/turna_summarization_mlsum", device=0)
90
  return summarization_model(input)[0]["generated_text"]
91
 
 
 
 
92
 
 
93
 
94
- with gr.Blocks(theme="soft") as demo:
95
  gr.Markdown("# TURNA 🐦")
96
  gr.Markdown(DESCRIPTION)
97
 
@@ -108,6 +112,18 @@ with gr.Blocks(theme="soft") as demo:
108
  sentiment_submit.click(sentiment_analysis, inputs=[sentiment_input, sentiment_choice], outputs=sentiment_output)
109
  sentiment_examples = gr.Examples(examples = sentiment_example, inputs = [sentiment_input, sentiment_choice], outputs=sentiment_output, fn=sentiment_analysis)
110
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
  with gr.Tab("NLI"):
113
  gr.Markdown("TURNA fine-tuned on natural language inference. Enter text to infer entailment and pick the model. You can also check for semantic similarity entailment.")
 
22
  ner_example = [["Benim adım Turna."]]
23
  t2t_example = [["Paraphrase: Bu üründen çok memnun kaldım."]]
24
  nli_example = [["Bunu çok beğendim. Bunu çok sevdim."]]
25
+ text_category_example = [[" anadolu_efes e 18 lik star ! beko_basketbol_ligi nde iddialı bir kadroyla sezona giren anadolu_efes transfer harekatına devam ediyor"]]
26
 
27
 
28
 
 
89
  summarization_model = pipeline(model="boun-tabi-LMG/turna_summarization_mlsum", device=0)
90
  return summarization_model(input)[0]["generated_text"]
91
 
92
+ @spaces.GPU
93
+ def categorize(input):
94
+ ttc = pipeline(model="boun-tabi-LMG/turna_classification_ttc4900", device=0)
95
 
96
+ return ttc(input)[0]["generated_text"]
97
 
98
+ with gr.Blocks(theme="abidlabs/Lime") as demo:
99
  gr.Markdown("# TURNA 🐦")
100
  gr.Markdown(DESCRIPTION)
101
 
 
112
  sentiment_submit.click(sentiment_analysis, inputs=[sentiment_input, sentiment_choice], outputs=sentiment_output)
113
  sentiment_examples = gr.Examples(examples = sentiment_example, inputs = [sentiment_input, sentiment_choice], outputs=sentiment_output, fn=sentiment_analysis)
114
 
115
+ with gr.Tab("Text Categorization"):
116
+ gr.Markdown("TURNA fine-tuned on text categorization. Enter text to categorize text or try the example.")
117
+ with gr.Column():
118
+ with gr.Row():
119
+ with gr.Column():
120
+ text_input = gr.Textbox(label="Text Categorization Input")
121
+
122
+ text_submit = gr.Button()
123
+ text_output = gr.Textbox(label="Text Categorization Output")
124
+ text_submit.click(categorize, inputs=[text_input, text_choice], outputs=text_output)
125
+ text_examples = gr.Examples(examples = text_category_example, inputs = [text_input, text_choice], outputs=text_output, fn=categorize)
126
+
127
 
128
  with gr.Tab("NLI"):
129
  gr.Markdown("TURNA fine-tuned on natural language inference. Enter text to infer entailment and pick the model. You can also check for semantic similarity entailment.")