Spaces:
Sleeping
Sleeping
Upload trend_utils.py
Browse files- src/trend_utils.py +10 -5
src/trend_utils.py
CHANGED
@@ -200,7 +200,6 @@ def get_plot(df: pd.DataFrame, start_date: str = '2023-06-01', end_date: str = '
|
|
200 |
x="Release date",
|
201 |
y="clemscore",
|
202 |
color="Model Type", # Differentiates the datasets by color
|
203 |
-
text="label_model", # Adds text labels from the 'label_model' column
|
204 |
hover_name="model",
|
205 |
size=marker_size,
|
206 |
size_max=40, # Max size of the circles
|
@@ -264,6 +263,7 @@ def get_plot(df: pd.DataFrame, start_date: str = '2023-06-01', end_date: str = '
|
|
264 |
tickfont=dict(size=10)
|
265 |
)
|
266 |
fig.update_yaxes(range=[0, 110]) # Set y-axis range to 110 for better visibility of legend and avoiding overlap with interactivity block of plotly on top-right
|
|
|
267 |
else:
|
268 |
fig.update_xaxes(
|
269 |
tickvals=custom_tickvals + benchmark_tickvals, # Use filtered_custom_tickvals
|
@@ -273,18 +273,23 @@ def get_plot(df: pd.DataFrame, start_date: str = '2023-06-01', end_date: str = '
|
|
273 |
tickfont=dict(size=10)
|
274 |
)
|
275 |
fig.update_yaxes(range=[0, max_clemscore+10])
|
|
|
276 |
|
277 |
|
278 |
# Add lines connecting the points for open models
|
279 |
fig.add_trace(go.Scatter(x=df_open['Release date'], y=df_open['clemscore'],
|
280 |
-
mode=
|
281 |
-
|
|
|
|
|
282 |
line=dict(color=open_color), showlegend=False))
|
283 |
|
284 |
# Add lines connecting the points for commercial models
|
285 |
fig.add_trace(go.Scatter(x=df_commercial['Release date'], y=df_commercial['clemscore'],
|
286 |
-
mode=
|
287 |
-
|
|
|
|
|
288 |
line=dict(color=comm_color), showlegend=False))
|
289 |
|
290 |
|
|
|
200 |
x="Release date",
|
201 |
y="clemscore",
|
202 |
color="Model Type", # Differentiates the datasets by color
|
|
|
203 |
hover_name="model",
|
204 |
size=marker_size,
|
205 |
size_max=40, # Max size of the circles
|
|
|
263 |
tickfont=dict(size=10)
|
264 |
)
|
265 |
fig.update_yaxes(range=[0, 110]) # Set y-axis range to 110 for better visibility of legend and avoiding overlap with interactivity block of plotly on top-right
|
266 |
+
display_mode = 'lines+markers'
|
267 |
else:
|
268 |
fig.update_xaxes(
|
269 |
tickvals=custom_tickvals + benchmark_tickvals, # Use filtered_custom_tickvals
|
|
|
273 |
tickfont=dict(size=10)
|
274 |
)
|
275 |
fig.update_yaxes(range=[0, max_clemscore+10])
|
276 |
+
display_mode = 'lines+markers+text'
|
277 |
|
278 |
|
279 |
# Add lines connecting the points for open models
|
280 |
fig.add_trace(go.Scatter(x=df_open['Release date'], y=df_open['clemscore'],
|
281 |
+
mode=display_mode, # Include 'text' in the mode
|
282 |
+
name='Open Models Trendline',
|
283 |
+
text=df_open['label_model'], # Use label_model for text labels
|
284 |
+
textposition='top center', # Position of the text labels
|
285 |
line=dict(color=open_color), showlegend=False))
|
286 |
|
287 |
# Add lines connecting the points for commercial models
|
288 |
fig.add_trace(go.Scatter(x=df_commercial['Release date'], y=df_commercial['clemscore'],
|
289 |
+
mode=display_mode, # Include 'text' in the mode
|
290 |
+
name='Commercial Models Trendline',
|
291 |
+
text=df_commercial['label_model'], # Use label_model for text labels
|
292 |
+
textposition='top center', # Position of the text labels
|
293 |
line=dict(color=comm_color), showlegend=False))
|
294 |
|
295 |
|