Spaces:
Sleeping
Sleeping
adrianpierce
commited on
Commit
·
5bae2a3
1
Parent(s):
b70c12c
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,9 @@ import numpy as np
|
|
3 |
import pandas as pd
|
4 |
import plotly.graph_objects as go
|
5 |
import networkx as nx
|
|
|
|
|
|
|
6 |
st.set_page_config(layout="wide")
|
7 |
|
8 |
# Load and process data
|
@@ -38,19 +41,19 @@ st.title('Spices Across Cuisines')
|
|
38 |
col1, col2, col3 = st.columns(3)
|
39 |
|
40 |
with col1:
|
41 |
-
st.
|
42 |
select_cuisine = st.selectbox('Select a cuisine to view the top 10 spices',cuisines.keys())
|
43 |
st.write(f'The top 10 ingredients in {select_cuisine} are:', cuisines[select_cuisine])
|
44 |
|
45 |
with col2:
|
46 |
-
st.
|
47 |
select_spice = st.selectbox('Select a spice to view which cuisines it is present in',spices.keys())
|
48 |
st.write(f'{select_spice} is part of the following cuisines:', spices[select_spice])
|
49 |
|
50 |
with col3:
|
51 |
-
st.
|
52 |
select_cuisine_sim = st.selectbox('Select a cuisine to view most similar cuisines by spices',cuisines.keys())
|
53 |
-
st.write(f'{select_cuisine_sim} is part of the following cuisines:', cuisine_similarity[select_cuisine_sim].sort_values(ascending=False).index[1:])
|
54 |
|
55 |
|
56 |
|
|
|
3 |
import pandas as pd
|
4 |
import plotly.graph_objects as go
|
5 |
import networkx as nx
|
6 |
+
import random
|
7 |
+
random.seed(42)
|
8 |
+
np.random.seed(42)
|
9 |
st.set_page_config(layout="wide")
|
10 |
|
11 |
# Load and process data
|
|
|
41 |
col1, col2, col3 = st.columns(3)
|
42 |
|
43 |
with col1:
|
44 |
+
st.subheader('By Cuisine')
|
45 |
select_cuisine = st.selectbox('Select a cuisine to view the top 10 spices',cuisines.keys())
|
46 |
st.write(f'The top 10 ingredients in {select_cuisine} are:', cuisines[select_cuisine])
|
47 |
|
48 |
with col2:
|
49 |
+
st.subheader('By Spice')
|
50 |
select_spice = st.selectbox('Select a spice to view which cuisines it is present in',spices.keys())
|
51 |
st.write(f'{select_spice} is part of the following cuisines:', spices[select_spice])
|
52 |
|
53 |
with col3:
|
54 |
+
st.subheader("Similar Cuisines")
|
55 |
select_cuisine_sim = st.selectbox('Select a cuisine to view most similar cuisines by spices',cuisines.keys())
|
56 |
+
st.write(f'{select_cuisine_sim} is part of the following cuisines:', cuisine_similarity[select_cuisine_sim].sort_values(ascending=False).index[1:]).to_list()
|
57 |
|
58 |
|
59 |
|