Update app.py
Browse files
app.py
CHANGED
@@ -23,6 +23,9 @@ def list2text(label_list):
|
|
23 |
label_list_1 = ["dünya", "ekonomi", "kültür", "sağlık", "siyaset", "spor", "teknoloji"]
|
24 |
label_list_2 = ["positive", "negative", "neutral"]
|
25 |
|
|
|
|
|
|
|
26 |
st.title("Multilingual Zero-Shot Text Classification with mT5")
|
27 |
|
28 |
model_name = "alan-turing-institute/mt5-large-finetuned-mnli-xtreme-xnli"
|
@@ -38,9 +41,12 @@ st.text_area("Text #1", text_1, height=128)
|
|
38 |
st.text_area("Text #2", text_2, height=128)
|
39 |
st.write(f"Label List #1: {list2text(label_list_1)}")
|
40 |
st.write(f"Label List #2: {list2text(label_list_2)}")
|
|
|
|
|
41 |
|
42 |
text = st.radio("Select Text", ("Text #1", "Text #2", "New Text"))
|
43 |
labels = st.radio("Select Label List", ("Label List #1", "Label List #2", "New Label List"))
|
|
|
44 |
|
45 |
if text == "Text #1": sequence_to_classify = text_1
|
46 |
elif text == "Text #2": sequence_to_classify = text_2
|
@@ -52,7 +58,10 @@ elif labels == "Label List #2": candidate_labels = label_list_2
|
|
52 |
elif labels == "New Label List":
|
53 |
candidate_labels = st.text_area("New Label List (Pls Input as comma-separated)", value="", height=16).split(",")
|
54 |
|
55 |
-
|
|
|
|
|
|
|
56 |
|
57 |
Run_Button = st.button("Run", key=None)
|
58 |
if Run_Button == True:
|
|
|
23 |
label_list_1 = ["dünya", "ekonomi", "kültür", "sağlık", "siyaset", "spor", "teknoloji"]
|
24 |
label_list_2 = ["positive", "negative", "neutral"]
|
25 |
|
26 |
+
hypothesis_1 = "Bu yazı {} konusundadır"
|
27 |
+
hypothesis_2 = "This text is in {} subject"
|
28 |
+
|
29 |
st.title("Multilingual Zero-Shot Text Classification with mT5")
|
30 |
|
31 |
model_name = "alan-turing-institute/mt5-large-finetuned-mnli-xtreme-xnli"
|
|
|
41 |
st.text_area("Text #2", text_2, height=128)
|
42 |
st.write(f"Label List #1: {list2text(label_list_1)}")
|
43 |
st.write(f"Label List #2: {list2text(label_list_2)}")
|
44 |
+
st.write(f"Hypothesis #1: {hyphothesis_1}")
|
45 |
+
st.write(f"Hypothesis #2: {hyphothesis_2}")
|
46 |
|
47 |
text = st.radio("Select Text", ("Text #1", "Text #2", "New Text"))
|
48 |
labels = st.radio("Select Label List", ("Label List #1", "Label List #2", "New Label List"))
|
49 |
+
hyphothesis = st.radio("Select Hyphothesis", ("Hyphothesis #1", "Hyphothesis #2", "New Hyphothesis"))
|
50 |
|
51 |
if text == "Text #1": sequence_to_classify = text_1
|
52 |
elif text == "Text #2": sequence_to_classify = text_2
|
|
|
58 |
elif labels == "New Label List":
|
59 |
candidate_labels = st.text_area("New Label List (Pls Input as comma-separated)", value="", height=16).split(",")
|
60 |
|
61 |
+
if hyphothesis == "Hyphothesis #1": hyphothesis_template = hyphothesis_1
|
62 |
+
elif hyphothesis == "Hyphothesis #2": hyphothesis_template = hyphothesis_2
|
63 |
+
elif labels == "New Hyphothesis":
|
64 |
+
hyphothesis_template = st.text_area("Hypothesis Template for NLI (Pls Input as comma-separated)", value="", height=16)
|
65 |
|
66 |
Run_Button = st.button("Run", key=None)
|
67 |
if Run_Button == True:
|