Remove the tabs
Browse files
app.py
CHANGED
|
@@ -107,43 +107,41 @@ def render_metadata():
|
|
| 107 |
# render_svg(open("assets/ALDi_logo.svg").read())
|
| 108 |
render_metadata()
|
| 109 |
|
| 110 |
-
tab1= st.tabs(["Input a Sentence"])
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
)
|
| 116 |
|
| 117 |
-
|
| 118 |
-
|
| 119 |
|
| 120 |
-
|
| 121 |
-
|
| 122 |
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
|
| 132 |
-
|
| 133 |
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
|
| 149 |
-
|
|
|
|
| 107 |
# render_svg(open("assets/ALDi_logo.svg").read())
|
| 108 |
render_metadata()
|
| 109 |
|
|
|
|
| 110 |
|
| 111 |
+
sent = st.text_input(
|
| 112 |
+
"Arabic Sentence:", placeholder="Enter an Arabic sentence.", on_change=None
|
| 113 |
+
)
|
|
|
|
| 114 |
|
| 115 |
+
# TODO: Check if this is needed!
|
| 116 |
+
clicked = st.button("Submit")
|
| 117 |
|
| 118 |
+
if sent:
|
| 119 |
+
valid_dialects = predict_binary_outcomes(model, tokenizer, sent)
|
| 120 |
|
| 121 |
+
ORANGE_COLOR = "#FF8000"
|
| 122 |
+
fig, ax = plt.subplots(figsize=(8, 1))
|
| 123 |
+
fig.patch.set_facecolor("none")
|
| 124 |
+
ax.set_facecolor("none")
|
| 125 |
|
| 126 |
+
ax.spines["left"].set_color(ORANGE_COLOR)
|
| 127 |
+
ax.spines["bottom"].set_color(ORANGE_COLOR)
|
| 128 |
+
ax.tick_params(axis="x", colors=ORANGE_COLOR)
|
| 129 |
|
| 130 |
+
ax.spines[["right", "top"]].set_visible(False)
|
| 131 |
|
| 132 |
+
dialect_labels = [int(dialect in valid_dialects) for dialect in DIALECTS]
|
| 133 |
+
im = ax.imshow(dialect_labels, cmap="vanimo", alpha=0.5, vmin=0, vmax=1, annot=False)
|
| 134 |
+
ax.set_yticks(range(len(DIALECTS)))
|
| 135 |
+
ax.set_yticklabels(DIALECTS, fontsize=8)
|
| 136 |
+
ax.set_xticks([])
|
| 137 |
+
ax.set_title("Valid Dialects", color=ORANGE_COLOR)
|
| 138 |
|
| 139 |
+
# ax.barh(y=[0], width=[ALDi_score], color=ORANGE_COLOR)
|
| 140 |
+
# ax.set_xlim(0, 1)
|
| 141 |
+
# ax.set_ylim(-1, 1)
|
| 142 |
+
# ax.set_title(f"ALDi score is: {round(ALDi_score, 3)}", color=ORANGE_COLOR)
|
| 143 |
+
# ax.get_yaxis().set_visible(False)
|
| 144 |
+
# ax.set_xlabel("ALDi score", color=ORANGE_COLOR)
|
| 145 |
+
st.pyplot(fig)
|
| 146 |
|
| 147 |
+
print(sent)
|