Spaces:
Paused
Paused
Commit
·
38c66c7
1
Parent(s):
ca68a3c
Added first and second sentence to NLI, STS
Browse files
app.py
CHANGED
|
@@ -51,18 +51,20 @@ sentiment_example = [["Bu üründen çok memnun kaldım."]]
|
|
| 51 |
long_text = [["Eyfel Kulesi (Fransızca: La tour Eiffel [la tuʀ ɛˈfɛl]), Paris'teki demir kule. Kule, aynı zamanda tüm dünyada Fransa'nın sembolü halini almıştır. İsmini, inşa ettiren Fransız inşaat mühendisi Gustave Eiffel'den alır.[1] En büyük turizm cazibelerinden biri olan Eyfel Kulesi, yılda 6 milyon turist çeker. 2002 yılında toplam ziyaretçi sayısı 200 milyona ulaşmıştır."], ["Kalp krizi geçirenlerin yaklaşık üçte birinin kısa bir süre önce grip atlattığı düşünülüyor. Peki grip virüsü ne yapıyor da kalp krizine yol açıyor? Karpuz şöyle açıkladı: Grip virüsü kanın yapışkanlığını veya pıhtılaşmasını artırıyor."]]
|
| 52 |
ner_example = [["Benim adım Turna."]]
|
| 53 |
t2t_example = [["Paraphrase: Bu üründen çok memnun kaldım."]]
|
| 54 |
-
nli_example = [["Bunu çok beğendim. Bunu çok sevdim."]]
|
| 55 |
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"]]
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
@spaces.GPU
|
| 60 |
-
def nli(
|
| 61 |
|
| 62 |
if model_choice=="turna_nli_nli_tr":
|
|
|
|
| 63 |
nli_model = pipeline(model="boun-tabi-LMG/turna_nli_nli_tr", device=0)
|
| 64 |
return nli_model(input)[0]["generated_text"]
|
| 65 |
else:
|
|
|
|
| 66 |
stsb_model = pipeline(model="boun-tabi-LMG/turna_semantic_similarity_stsb_tr", device=0)
|
| 67 |
|
| 68 |
return stsb_model(input)[0]["generated_text"]
|
|
@@ -169,18 +171,19 @@ with gr.Blocks(theme="abidlabs/Lime") as demo:
|
|
| 169 |
text_examples = gr.Examples(examples = text_category_example,inputs=[text_input], outputs=text_output, fn=categorize)
|
| 170 |
|
| 171 |
|
| 172 |
-
with gr.Tab("NLI"):
|
| 173 |
-
gr.Markdown("TURNA fine-tuned on natural language inference. Enter text to infer entailment
|
| 174 |
with gr.Column():
|
| 175 |
with gr.Row():
|
| 176 |
with gr.Column():
|
| 177 |
nli_choice = gr.Radio(choices = ["turna_nli_nli_tr", "turna_semantic_similarity_stsb_tr"], label ="Model", value="turna_nli_nli_tr")
|
| 178 |
-
|
| 179 |
-
|
|
|
|
| 180 |
nli_submit = gr.Button()
|
| 181 |
nli_output = gr.Textbox(label="NLI Output")
|
| 182 |
-
nli_submit.click(nli, inputs=[
|
| 183 |
-
nli_examples = gr.Examples(examples = nli_example, inputs = [
|
| 184 |
|
| 185 |
with gr.Tab("POS"):
|
| 186 |
gr.Markdown("TURNA fine-tuned on part-of-speech-tagging. Enter text to parse parts of speech and pick the model.")
|
|
|
|
| 51 |
long_text = [["Eyfel Kulesi (Fransızca: La tour Eiffel [la tuʀ ɛˈfɛl]), Paris'teki demir kule. Kule, aynı zamanda tüm dünyada Fransa'nın sembolü halini almıştır. İsmini, inşa ettiren Fransız inşaat mühendisi Gustave Eiffel'den alır.[1] En büyük turizm cazibelerinden biri olan Eyfel Kulesi, yılda 6 milyon turist çeker. 2002 yılında toplam ziyaretçi sayısı 200 milyona ulaşmıştır."], ["Kalp krizi geçirenlerin yaklaşık üçte birinin kısa bir süre önce grip atlattığı düşünülüyor. Peki grip virüsü ne yapıyor da kalp krizine yol açıyor? Karpuz şöyle açıkladı: Grip virüsü kanın yapışkanlığını veya pıhtılaşmasını artırıyor."]]
|
| 52 |
ner_example = [["Benim adım Turna."]]
|
| 53 |
t2t_example = [["Paraphrase: Bu üründen çok memnun kaldım."]]
|
| 54 |
+
nli_example = [["Bunu çok beğendim.", "Bunu çok sevdim."]]
|
| 55 |
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"]]
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
@spaces.GPU
|
| 60 |
+
def nli(first_input, second_input, model_choice="turna_nli_nli_tr"):
|
| 61 |
|
| 62 |
if model_choice=="turna_nli_nli_tr":
|
| 63 |
+
input = f"hipotez: {hypothesis} önerme: {premise}"
|
| 64 |
nli_model = pipeline(model="boun-tabi-LMG/turna_nli_nli_tr", device=0)
|
| 65 |
return nli_model(input)[0]["generated_text"]
|
| 66 |
else:
|
| 67 |
+
input = f"ilk cümle: {first_input} ikinci cümle: {second_input}"
|
| 68 |
stsb_model = pipeline(model="boun-tabi-LMG/turna_semantic_similarity_stsb_tr", device=0)
|
| 69 |
|
| 70 |
return stsb_model(input)[0]["generated_text"]
|
|
|
|
| 171 |
text_examples = gr.Examples(examples = text_category_example,inputs=[text_input], outputs=text_output, fn=categorize)
|
| 172 |
|
| 173 |
|
| 174 |
+
with gr.Tab("NLI & STS"):
|
| 175 |
+
gr.Markdown("TURNA fine-tuned on natural language inference or semantic textual similarity. Enter text to infer entailment or measure semantic similarity. ")
|
| 176 |
with gr.Column():
|
| 177 |
with gr.Row():
|
| 178 |
with gr.Column():
|
| 179 |
nli_choice = gr.Radio(choices = ["turna_nli_nli_tr", "turna_semantic_similarity_stsb_tr"], label ="Model", value="turna_nli_nli_tr")
|
| 180 |
+
nli_first_input = gr.Textbox(label="First Sentence")
|
| 181 |
+
nli_second_input = gr.Textbox(label="Second Sentence")
|
| 182 |
+
|
| 183 |
nli_submit = gr.Button()
|
| 184 |
nli_output = gr.Textbox(label="NLI Output")
|
| 185 |
+
nli_submit.click(nli, inputs=[nli_first_input, nli_second_input, nli_choice], outputs=nli_output)
|
| 186 |
+
nli_examples = gr.Examples(examples = nli_example, inputs = [nli_first_input, nli_second_input, nli_choice], outputs=nli_output, fn=nli)
|
| 187 |
|
| 188 |
with gr.Tab("POS"):
|
| 189 |
gr.Markdown("TURNA fine-tuned on part-of-speech-tagging. Enter text to parse parts of speech and pick the model.")
|