Spaces:
Runtime error
Runtime error
try to fix overlapping cols
Browse files
app.py
CHANGED
@@ -24,45 +24,47 @@ if method_selection == METHOD_OPTIONS["nsp"]:
|
|
24 |
|
25 |
st.header("Configure prompts and labels")
|
26 |
col1, col2 = st.columns(2)
|
27 |
-
col1.subheader("Candidate labels")
|
28 |
-
labels = col1.text_area(
|
29 |
-
label="These are the labels that the model will try to predict for the given text input. Your input labels should be comma separated and meaningful.",
|
30 |
-
value="spor,dünya,siyaset,ekonomi,kültür ve sanat",
|
31 |
-
)
|
32 |
-
col2.subheader("Prompt template")
|
33 |
-
prompt_template = col2.text_area(
|
34 |
-
label="Prompt template is used to transform NLI and NSP tasks into a general-use zero-shot classifier. Models replace {} with the labels that you have given.",
|
35 |
-
value="Bu metin {} kategorisine aittir",
|
36 |
-
)
|
37 |
|
38 |
-
col1
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
"
|
58 |
-
"
|
59 |
-
"
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
st.header("Configure prompts and labels")
|
26 |
col1, col2 = st.columns(2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
+
with col1:
|
29 |
+
st.subheader("Candidate labels")
|
30 |
+
labels = st.text_area(
|
31 |
+
label="These are the labels that the model will try to predict for the given text input. Your input labels should be comma separated and meaningful.",
|
32 |
+
value="spor,dünya,siyaset,ekonomi,kültür ve sanat",
|
33 |
+
)
|
34 |
+
st.header("Make predictions")
|
35 |
+
st.text_area("", value="Enter some text to classify.")
|
36 |
+
st.button("Predict")
|
37 |
|
38 |
+
with col2:
|
39 |
+
st.subheader("Prompt template")
|
40 |
+
prompt_template = st.text_area(
|
41 |
+
label="Prompt template is used to transform NLI and NSP tasks into a general-use zero-shot classifier. Models replace {} with the labels that you have given.",
|
42 |
+
value="Bu metin {} kategorisine aittir",
|
43 |
+
)
|
44 |
+
st.header("")
|
45 |
+
probs = [0.86, 0.10, 0.01, 0.02, 0.01]
|
46 |
+
data = pd.DataFrame(
|
47 |
+
{"labels": labels.split(","), "probability": probs}
|
48 |
+
).sort_values(by="probability", ascending=False)
|
49 |
+
chart = px.bar(
|
50 |
+
data,
|
51 |
+
x="probability",
|
52 |
+
y="labels",
|
53 |
+
color="labels",
|
54 |
+
orientation="h",
|
55 |
+
height=290,
|
56 |
+
width=500,
|
57 |
+
).update_layout(
|
58 |
+
{
|
59 |
+
"xaxis": {"title": "probability", "visible": True, "showticklabels": True},
|
60 |
+
"yaxis": {"title": None, "visible": True, "showticklabels": True},
|
61 |
+
"margin": dict(
|
62 |
+
l=10, # left
|
63 |
+
r=10, # right
|
64 |
+
t=50, # top
|
65 |
+
b=10, # bottom
|
66 |
+
),
|
67 |
+
"showlegend": False,
|
68 |
+
}
|
69 |
+
)
|
70 |
+
st.plotly_chart(chart)
|