Spaces:
Running
Running
Jellyfish042
commited on
Commit
Β·
89688fa
1
Parent(s):
42d5139
pie chart
Browse files
app.py
CHANGED
@@ -212,6 +212,38 @@ def update_table(period: str,
|
|
212 |
else:
|
213 |
return pd.DataFrame()
|
214 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
|
216 |
def check_model_exists(model_id):
|
217 |
api = HfApi()
|
@@ -430,6 +462,7 @@ with gr.Blocks(css=css) as demo:
|
|
430 |
|
431 |
with gr.Tab("π MultiLang"):
|
432 |
gr.Markdown("## Coming soon...")
|
|
|
433 |
with gr.Tab("π Scaling Law"):
|
434 |
print(time_list)
|
435 |
period_selector_2 = gr.Dropdown(label="Period", choices=time_list, value=last_period)
|
|
|
212 |
else:
|
213 |
return pd.DataFrame()
|
214 |
|
215 |
+
def create_world_languages_gdp_chart():
|
216 |
+
languages = ['English', 'Chinese', 'Spanish', 'Japanese', 'German', 'French', 'Arabic', 'Italian', 'Portuguese', 'Korean', 'Other']
|
217 |
+
shares = [27, 18, 8, 6, 5, 4, 3, 2, 2, 2, 23]
|
218 |
+
colors = ['#FF7F7F', '#FFA07A', '#FFDB58', '#90EE90', '#98FB98', '#87CEFA', '#B0C4DE', '#DDA0DD', '#D8BFD8', '#F0E68C', '#E0FFFF']
|
219 |
+
|
220 |
+
fig = go.Figure(data=[go.Pie(
|
221 |
+
labels=languages,
|
222 |
+
values=shares,
|
223 |
+
hole=0.3,
|
224 |
+
marker=dict(colors=colors, line=dict(color='#FFFFFF', width=2)),
|
225 |
+
textinfo='label+percent',
|
226 |
+
textposition='outside',
|
227 |
+
insidetextorientation='radial',
|
228 |
+
textfont=dict(size=12),
|
229 |
+
)])
|
230 |
+
|
231 |
+
fig.update_layout(
|
232 |
+
title={
|
233 |
+
'text': "World Languages by Share of Global GDP",
|
234 |
+
'y':0.95,
|
235 |
+
'x':0.5,
|
236 |
+
'xanchor': 'center',
|
237 |
+
'yanchor': 'top',
|
238 |
+
'font': dict(size=20, color='black')
|
239 |
+
},
|
240 |
+
showlegend=False,
|
241 |
+
width=700,
|
242 |
+
height=500,
|
243 |
+
margin=dict(t=80, b=20, l=20, r=20),
|
244 |
+
)
|
245 |
+
|
246 |
+
return fig
|
247 |
|
248 |
def check_model_exists(model_id):
|
249 |
api = HfApi()
|
|
|
462 |
|
463 |
with gr.Tab("π MultiLang"):
|
464 |
gr.Markdown("## Coming soon...")
|
465 |
+
world_languages_plot = gr.Plot(create_world_languages_gdp_chart())
|
466 |
with gr.Tab("π Scaling Law"):
|
467 |
print(time_list)
|
468 |
period_selector_2 = gr.Dropdown(label="Period", choices=time_list, value=last_period)
|