Spaces:
Sleeping
Sleeping
yolo
Browse files- app/app.py +6 -1
- app/dashboard.ipynb +16 -131
app/app.py
CHANGED
@@ -18,7 +18,12 @@ app = Dash(__name__, external_stylesheets=external_stylesheets)
|
|
18 |
app.layout = html.Div([
|
19 |
dcc.Location(id='url', refresh=False),
|
20 |
html.Div(id='page-content')
|
21 |
-
]
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
server = app.server
|
24 |
|
|
|
18 |
app.layout = html.Div([
|
19 |
dcc.Location(id='url', refresh=False),
|
20 |
html.Div(id='page-content')
|
21 |
+
], style={
|
22 |
+
'background-color': '#333', # Dark background color
|
23 |
+
'color': '#fff', # Text color
|
24 |
+
'min-height': '100vh', # Ensure it covers the full viewport height
|
25 |
+
'padding': '20px' # Add some padding
|
26 |
+
})
|
27 |
|
28 |
server = app.server
|
29 |
|
app/dashboard.ipynb
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
-
"execution_count":
|
6 |
"metadata": {},
|
7 |
"outputs": [
|
8 |
{
|
9 |
"name": "stderr",
|
10 |
"output_type": "stream",
|
11 |
"text": [
|
12 |
-
"/var/folders/b4/lwfgccm95kqd2skcwvrt2fr00000gn/T/ipykernel_289/
|
13 |
"\n",
|
14 |
"Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n",
|
15 |
"\n"
|
@@ -30,7 +30,7 @@
|
|
30 |
" "
|
31 |
],
|
32 |
"text/plain": [
|
33 |
-
"<IPython.lib.display.IFrame at
|
34 |
]
|
35 |
},
|
36 |
"metadata": {},
|
@@ -48,6 +48,13 @@
|
|
48 |
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
|
49 |
"\n"
|
50 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
],
|
53 |
"source": [
|
@@ -71,7 +78,12 @@
|
|
71 |
"app.layout = html.Div([\n",
|
72 |
" dcc.Location(id='url', refresh=False),\n",
|
73 |
" html.Div(id='page-content')\n",
|
74 |
-
"]
|
|
|
|
|
|
|
|
|
|
|
75 |
"\n",
|
76 |
"server = app.server\n",
|
77 |
"\n",
|
@@ -361,133 +373,6 @@
|
|
361 |
"if __name__ == \"__main__\":\n",
|
362 |
" app.run_server(host=\"0.0.0.0\", port=\"8050\", debug=debug)"
|
363 |
]
|
364 |
-
},
|
365 |
-
{
|
366 |
-
"cell_type": "code",
|
367 |
-
"execution_count": 23,
|
368 |
-
"metadata": {},
|
369 |
-
"outputs": [
|
370 |
-
{
|
371 |
-
"name": "stderr",
|
372 |
-
"output_type": "stream",
|
373 |
-
"text": [
|
374 |
-
"/var/folders/b4/lwfgccm95kqd2skcwvrt2fr00000gn/T/ipykernel_289/3647116673.py:50: FutureWarning:\n",
|
375 |
-
"\n",
|
376 |
-
"Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n",
|
377 |
-
"\n"
|
378 |
-
]
|
379 |
-
}
|
380 |
-
],
|
381 |
-
"source": [
|
382 |
-
"dashboard_layout = html.Div([\n",
|
383 |
-
" html.H1(children='Wineyards around the world', style={'textAlign': 'center', 'color': '#fff', 'padding': '20px'}),\n",
|
384 |
-
" \n",
|
385 |
-
" html.Div(\n",
|
386 |
-
" [\n",
|
387 |
-
" html.Div(\n",
|
388 |
-
" [\n",
|
389 |
-
" html.H4(children='Country', style={'textAlign': 'center', 'color': '#fff'}),\n",
|
390 |
-
" dcc.Dropdown(wine_country, wine_country[-1], id='dropdown-wc', style={'color': '#000'}),\n",
|
391 |
-
" ], className='six columns', style={'padding': '10px'}\n",
|
392 |
-
" ),\n",
|
393 |
-
" html.Div(\n",
|
394 |
-
" [\n",
|
395 |
-
" html.H4(children='Region', style={'textAlign': 'center', 'color': '#fff'}),\n",
|
396 |
-
" dcc.Dropdown(['all'], 'all', id='dropdown-wr', style={'color': '#000'}),\n",
|
397 |
-
" ], className='six columns', style={'padding': '10px'}\n",
|
398 |
-
" )\n",
|
399 |
-
" ], className='row', style={'background-color': '#444', 'border-radius': '10px', 'margin': '10px'}),\n",
|
400 |
-
" \n",
|
401 |
-
" dcc.Graph(id='world-map-fig', style={'margin': '20px'}),\n",
|
402 |
-
" \n",
|
403 |
-
" html.Div(\n",
|
404 |
-
" [\n",
|
405 |
-
" html.Div(\n",
|
406 |
-
" [\n",
|
407 |
-
" html.H4(children='Wine Recommender', style={'textAlign': 'center', 'color': '#fff'}),\n",
|
408 |
-
" dcc.Dropdown(wine_list, wine_list[0], id='dropdown-selection', style={'color': '#000'}),\n",
|
409 |
-
" html.P(id='wine-recommendation', style={'textAlign': 'center', 'color': '#fff'}),\n",
|
410 |
-
" ], className='three columns', style={'padding': '10px'}\n",
|
411 |
-
" ),\n",
|
412 |
-
" html.Div(\n",
|
413 |
-
" [\n",
|
414 |
-
" html.P(children='Data Example', style={'textAlign': 'left', 'color': '#fff'}),\n",
|
415 |
-
" dash_table.DataTable(\n",
|
416 |
-
" data=raw_wine_similarity_df.to_dict('records'),\n",
|
417 |
-
" columns=[{'id': c, 'name': c} for c in raw_wine_similarity_df.columns],\n",
|
418 |
-
" style_header={'backgroundColor': '#444', 'color': '#fff'},\n",
|
419 |
-
" style_cell={'backgroundColor': '#333', 'color': '#fff'}\n",
|
420 |
-
" )\n",
|
421 |
-
" ], className='nine columns', style={'padding': '10px'}\n",
|
422 |
-
" )\n",
|
423 |
-
" ], className='row', style={'background-color': '#444', 'border-radius': '10px', 'margin': '10px'}),\n",
|
424 |
-
" \n",
|
425 |
-
" html.H4(children=\"Wine Recommender based on users' feedback\", style={'textAlign': 'center', 'color': '#fff', 'padding': '20px'}),\n",
|
426 |
-
" \n",
|
427 |
-
" html.Div(\n",
|
428 |
-
" [\n",
|
429 |
-
" html.Div(\n",
|
430 |
-
" [\n",
|
431 |
-
" dcc.Dropdown(user_ids, user_ids[0], id='dropdown-selection-user', style={'color': '#000'}),\n",
|
432 |
-
" html.P(id='wine-recommendation-from-user', style={'textAlign': 'center', 'color': '#fff'}),\n",
|
433 |
-
" ], className='six columns', style={'padding': '10px'}\n",
|
434 |
-
" ),\n",
|
435 |
-
" html.Div(\n",
|
436 |
-
" [\n",
|
437 |
-
" html.P(children='Data Example', style={'textAlign': 'left', 'color': '#fff'}),\n",
|
438 |
-
" dash_table.DataTable(\n",
|
439 |
-
" data=raw_ratings.to_dict('records'),\n",
|
440 |
-
" columns=[{'id': c, 'name': c} for c in raw_ratings.columns],\n",
|
441 |
-
" style_header={'backgroundColor': '#444', 'color': '#fff'},\n",
|
442 |
-
" style_cell={'backgroundColor': '#333', 'color': '#fff'}\n",
|
443 |
-
" )\n",
|
444 |
-
" ], className='six columns', style={'padding': '10px'}\n",
|
445 |
-
" ),\n",
|
446 |
-
" ], className='row', style={'background-color': '#444', 'border-radius': '10px', 'margin': '10px'}),\n",
|
447 |
-
" \n",
|
448 |
-
" html.H4(children=\"Wine Preferences Form\", style={'textAlign': 'center', 'color': '#fff', 'padding': '20px'}),\n",
|
449 |
-
" \n",
|
450 |
-
" html.Div(\n",
|
451 |
-
" [\n",
|
452 |
-
" html.Div(\n",
|
453 |
-
" [\n",
|
454 |
-
" dcc.Dropdown(wine_list, wine_list[0], id='dropdown-selection-wine-form', style={'color': '#000'}),\n",
|
455 |
-
" dcc.Input(id='input-wine-rating', type='number', placeholder='Enter wine rating', min=1, max=5, style={'margin-top': '10px'}),\n",
|
456 |
-
" ], className='six columns', style={'padding': '10px'}\n",
|
457 |
-
" ),\n",
|
458 |
-
" html.Div(\n",
|
459 |
-
" [\n",
|
460 |
-
" html.Button('Submit', id='submit-button', n_clicks=0, style={'margin-top': '10px', 'background-color': '#444', 'color': '#fff'}),\n",
|
461 |
-
" ], className='six columns', style={'padding': '10px'}\n",
|
462 |
-
" ),\n",
|
463 |
-
" ], className='row', style={'background-color': '#444', 'border-radius': '10px', 'margin': '10px'}),\n",
|
464 |
-
" \n",
|
465 |
-
" html.Div(id='recommended-wine-rating-info', style={'textAlign': 'center', 'color': '#fff', 'padding': '10px'}),\n",
|
466 |
-
" html.P(id='recommend-wine-from-form-text', style={'textAlign': 'center', 'color': '#fff'}),\n",
|
467 |
-
" \n",
|
468 |
-
" html.Div(\n",
|
469 |
-
" [\n",
|
470 |
-
" html.Button('Reset', id='recommend-wine-from-form-reset', n_clicks=0, style={'margin': '10px', 'background-color': '#444', 'color': '#fff'}),\n",
|
471 |
-
" html.Button('Recommend Wine', id='recommend-wine-from-form', n_clicks=0, style={'margin': '10px', 'background-color': '#444', 'color': '#fff'}),\n",
|
472 |
-
" ], style={'textAlign': 'center'}\n",
|
473 |
-
" ),\n",
|
474 |
-
" \n",
|
475 |
-
" html.Div(id='recommended-wine-form-output', style={'textAlign': 'center', 'color': '#fff', 'padding': '10px'}),\n",
|
476 |
-
"], style={\n",
|
477 |
-
" 'background-image': 'url(\"/assets/background.jpg\")',\n",
|
478 |
-
" 'background-size': 'cover',\n",
|
479 |
-
" 'font-family': 'Fantasy',\n",
|
480 |
-
" 'color': '#999',\n",
|
481 |
-
" 'padding': '20px'\n",
|
482 |
-
"})"
|
483 |
-
]
|
484 |
-
},
|
485 |
-
{
|
486 |
-
"cell_type": "code",
|
487 |
-
"execution_count": null,
|
488 |
-
"metadata": {},
|
489 |
-
"outputs": [],
|
490 |
-
"source": []
|
491 |
}
|
492 |
],
|
493 |
"metadata": {
|
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
+
"execution_count": 24,
|
6 |
"metadata": {},
|
7 |
"outputs": [
|
8 |
{
|
9 |
"name": "stderr",
|
10 |
"output_type": "stream",
|
11 |
"text": [
|
12 |
+
"/var/folders/b4/lwfgccm95kqd2skcwvrt2fr00000gn/T/ipykernel_289/426293969.py:99: FutureWarning:\n",
|
13 |
"\n",
|
14 |
"Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n",
|
15 |
"\n"
|
|
|
30 |
" "
|
31 |
],
|
32 |
"text/plain": [
|
33 |
+
"<IPython.lib.display.IFrame at 0x2a9f7d000>"
|
34 |
]
|
35 |
},
|
36 |
"metadata": {},
|
|
|
48 |
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
|
49 |
"\n"
|
50 |
]
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"name": "stdout",
|
54 |
+
"output_type": "stream",
|
55 |
+
"text": [
|
56 |
+
"Text Value: None\n"
|
57 |
+
]
|
58 |
}
|
59 |
],
|
60 |
"source": [
|
|
|
78 |
"app.layout = html.Div([\n",
|
79 |
" dcc.Location(id='url', refresh=False),\n",
|
80 |
" html.Div(id='page-content')\n",
|
81 |
+
"], style={\n",
|
82 |
+
" 'background-color': '#333', # Dark background color\n",
|
83 |
+
" 'color': '#fff', # Text color\n",
|
84 |
+
" 'min-height': '100vh', # Ensure it covers the full viewport height\n",
|
85 |
+
" 'padding': '20px' # Add some padding\n",
|
86 |
+
"})\n",
|
87 |
"\n",
|
88 |
"server = app.server\n",
|
89 |
"\n",
|
|
|
373 |
"if __name__ == \"__main__\":\n",
|
374 |
" app.run_server(host=\"0.0.0.0\", port=\"8050\", debug=debug)"
|
375 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
}
|
377 |
],
|
378 |
"metadata": {
|