Spaces:
Sleeping
Sleeping
Update visuals
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import plotly.graph_objects as go
|
|
6 |
import plotly.express as px
|
7 |
from st_social_media_links import SocialMediaIcons
|
8 |
|
|
|
9 |
AVERAGE_COLUMN_NAME = "Average"
|
10 |
SENTIMENT_COLUMN_NAME = "Sentiment"
|
11 |
RESULTS_COLUMN_NAME = "Results"
|
@@ -152,12 +153,21 @@ social_media_links = [
|
|
152 |
"https://www.facebook.com/Speakleash/"
|
153 |
]
|
154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
social_media_links_colors = [
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
]
|
162 |
|
163 |
social_media_icons = SocialMediaIcons(social_media_links, social_media_links_colors)
|
@@ -166,6 +176,7 @@ social_media_icons.render(justify_content='right')
|
|
166 |
# Add logo, title, and subheader in a flexible container with equal spacing
|
167 |
st.markdown("""
|
168 |
<div class="header-container">
|
|
|
169 |
<img src="https://speakleash.org/wp-content/uploads/2023/09/SpeakLeash_logo.svg" alt="SpeakLeash Logo">
|
170 |
<hr>
|
171 |
<div class="title-container">
|
@@ -189,55 +200,34 @@ with tab1:
|
|
189 |
styled_df_show = styler(styled_df_show)
|
190 |
|
191 |
st.data_editor(styled_df_show, column_config={
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
|
|
203 |
|
204 |
# Add selection for models and create a bar chart for selected models using the AVERAGE_COLUMN_NAME, SENTIMENT_COLUMN_NAME, PHRASEOLOGY_COLUMN_NAME, UNDERSTANDING_COLUMN_NAME
|
205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
selected_data = data[data["Model"].isin(selected_models)]
|
207 |
categories = [AVERAGE_COLUMN_NAME, SENTIMENT_COLUMN_NAME, PHRASEOLOGY_COLUMN_NAME, UNDERSTANDING_COLUMN_NAME]
|
208 |
|
209 |
if selected_models:
|
210 |
# Kolorki do wyboru:
|
211 |
# colors = px.colors.sample_colorscale("viridis", len(selected_models)+1)
|
212 |
-
colors = px.colors.qualitative.
|
213 |
-
|
214 |
-
# Create a chart with lines for each model for each category
|
215 |
-
fig = go.Figure()
|
216 |
-
for model, color in zip(selected_models, colors):
|
217 |
-
values = selected_data[selected_data['Model'] == model][categories].values.flatten().tolist()
|
218 |
-
values += values[:1] # Repeat the first value to close the polygon
|
219 |
-
|
220 |
-
fig.add_trace(go.Scatterpolar(
|
221 |
-
r=values,
|
222 |
-
theta=categories + [categories[0]], # Repeat the first category to close the polygon
|
223 |
-
name=model,
|
224 |
-
line_color=color,
|
225 |
-
fillcolor=color
|
226 |
-
))
|
227 |
-
|
228 |
-
fig.update_layout(
|
229 |
-
polar=dict(
|
230 |
-
radialaxis=dict(
|
231 |
-
visible=True,
|
232 |
-
range=[0, 5]
|
233 |
-
)),
|
234 |
-
showlegend=True,
|
235 |
-
legend=dict(orientation="h", yanchor="top", y=-0.2, xanchor="center", x=0.5),
|
236 |
-
title="Comparison of Selected Models",
|
237 |
-
template="plotly_dark"
|
238 |
-
)
|
239 |
-
st.plotly_chart(fig)
|
240 |
-
|
241 |
# Create a chart with bars for each model for each category
|
242 |
fig_bars = go.Figure()
|
243 |
for model, color in zip(selected_models, colors):
|
@@ -259,6 +249,8 @@ with tab1:
|
|
259 |
)
|
260 |
st.plotly_chart(fig_bars)
|
261 |
|
|
|
|
|
262 |
with tab2:
|
263 |
st.header("Opis")
|
264 |
st.write("Tutaj znajduje się trochę tekstu jako wypełniacz.")
|
@@ -276,4 +268,7 @@ st.markdown("""
|
|
276 |
- [Krzysztof Wróbel](https://www.linkedin.com/in/wrobelkrzysztof/) - engineering, methodological support
|
277 |
- [Szymon Baczyński](https://www.linkedin.com/in/szymon-baczynski/) - front-end / streamlit assistant
|
278 |
""")
|
|
|
|
|
|
|
279 |
# Run the app with `streamlit run your_script.py`
|
|
|
6 |
import plotly.express as px
|
7 |
from st_social_media_links import SocialMediaIcons
|
8 |
|
9 |
+
|
10 |
AVERAGE_COLUMN_NAME = "Average"
|
11 |
SENTIMENT_COLUMN_NAME = "Sentiment"
|
12 |
RESULTS_COLUMN_NAME = "Results"
|
|
|
153 |
"https://www.facebook.com/Speakleash/"
|
154 |
]
|
155 |
|
156 |
+
light_orange = "#FDA428"
|
157 |
+
dark_orange = "#A85E00"
|
158 |
+
white_color = "#FFFFFF"
|
159 |
+
black_color = "#000000"
|
160 |
+
links_color = white_color
|
161 |
+
|
162 |
+
# if theme.get('background_color') == white_color:
|
163 |
+
# links_color = black_color
|
164 |
+
|
165 |
social_media_links_colors = [
|
166 |
+
dark_orange,
|
167 |
+
dark_orange,
|
168 |
+
dark_orange,
|
169 |
+
dark_orange,
|
170 |
+
dark_orange
|
171 |
]
|
172 |
|
173 |
social_media_icons = SocialMediaIcons(social_media_links, social_media_links_colors)
|
|
|
176 |
# Add logo, title, and subheader in a flexible container with equal spacing
|
177 |
st.markdown("""
|
178 |
<div class="header-container">
|
179 |
+
<br>
|
180 |
<img src="https://speakleash.org/wp-content/uploads/2023/09/SpeakLeash_logo.svg" alt="SpeakLeash Logo">
|
181 |
<hr>
|
182 |
<div class="title-container">
|
|
|
200 |
styled_df_show = styler(styled_df_show)
|
201 |
|
202 |
st.data_editor(styled_df_show, column_config={
|
203 |
+
"Model": st.column_config.TextColumn("Model", help="Model name", width="large"),
|
204 |
+
"Params": st.column_config.NumberColumn("Params [B]", format="%.1f"),
|
205 |
+
AVERAGE_COLUMN_NAME: st.column_config.NumberColumn(AVERAGE_COLUMN_NAME),
|
206 |
+
RESULTS_COLUMN_NAME: st.column_config.BarChartColumn(
|
207 |
+
RESULTS_COLUMN_NAME, help="Summary of the results of each task",
|
208 |
+
y_min=0,y_max=5,),
|
209 |
+
SENTIMENT_COLUMN_NAME: st.column_config.NumberColumn(SENTIMENT_COLUMN_NAME, help='Ability to analyze sentiment'),
|
210 |
+
PHRASEOLOGY_COLUMN_NAME: st.column_config.NumberColumn(PHRASEOLOGY_COLUMN_NAME, help='Ability to understand phraseological compounds'),
|
211 |
+
UNDERSTANDING_COLUMN_NAME: st.column_config.NumberColumn(UNDERSTANDING_COLUMN_NAME, help='Ability to understand language'),
|
212 |
+
}, hide_index=True, disabled=True, height=500)
|
213 |
+
|
214 |
+
# st.divider()
|
215 |
|
216 |
# Add selection for models and create a bar chart for selected models using the AVERAGE_COLUMN_NAME, SENTIMENT_COLUMN_NAME, PHRASEOLOGY_COLUMN_NAME, UNDERSTANDING_COLUMN_NAME
|
217 |
+
# Add default selection of 3 best models from AVERAGE_COLUMN_NAME and 1 best model with "Bielik" in Model column
|
218 |
+
default_models = list(data.sort_values(AVERAGE_COLUMN_NAME, ascending=False)['Model'].head(3))
|
219 |
+
bielik_model = data[data['Model'].str.contains('Bielik')].sort_values(AVERAGE_COLUMN_NAME, ascending=False)['Model'].iloc[0]
|
220 |
+
if bielik_model not in default_models:
|
221 |
+
default_models.append(bielik_model)
|
222 |
+
selected_models = st.multiselect("Select models to compare", data["Model"].unique(), default=default_models)
|
223 |
+
# selected_models = st.multiselect("Select models to compare", data["Model"].unique())
|
224 |
selected_data = data[data["Model"].isin(selected_models)]
|
225 |
categories = [AVERAGE_COLUMN_NAME, SENTIMENT_COLUMN_NAME, PHRASEOLOGY_COLUMN_NAME, UNDERSTANDING_COLUMN_NAME]
|
226 |
|
227 |
if selected_models:
|
228 |
# Kolorki do wyboru:
|
229 |
# colors = px.colors.sample_colorscale("viridis", len(selected_models)+1)
|
230 |
+
colors = px.colors.qualitative.D3[:len(selected_models)]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
# Create a chart with bars for each model for each category
|
232 |
fig_bars = go.Figure()
|
233 |
for model, color in zip(selected_models, colors):
|
|
|
249 |
)
|
250 |
st.plotly_chart(fig_bars)
|
251 |
|
252 |
+
|
253 |
+
### Zakładka 2 --> Opis
|
254 |
with tab2:
|
255 |
st.header("Opis")
|
256 |
st.write("Tutaj znajduje się trochę tekstu jako wypełniacz.")
|
|
|
268 |
- [Krzysztof Wróbel](https://www.linkedin.com/in/wrobelkrzysztof/) - engineering, methodological support
|
269 |
- [Szymon Baczyński](https://www.linkedin.com/in/szymon-baczynski/) - front-end / streamlit assistant
|
270 |
""")
|
271 |
+
|
272 |
+
st.divider()
|
273 |
+
|
274 |
# Run the app with `streamlit run your_script.py`
|