adrianpierce commited on
Commit
33fba6c
·
1 Parent(s): 77679d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -8
app.py CHANGED
@@ -2,13 +2,10 @@ import streamlit as st
2
  import plotly.graph_objects as go
3
  import networkx as nx
4
  import pandas as pd
5
-
6
  st.set_page_config(layout="wide")
7
- # Load the CSV file
8
- df = pd.read_csv('spices_by_cuisine_with_all_flavors.csv', index_col=0)
9
-
10
- st.dataframe(df)
11
 
 
 
12
  pivot = df.drop(columns=['Flavor Description']).sort_index()
13
 
14
  cuisines = {}
@@ -22,11 +19,25 @@ for col in pivot_t.columns:
22
  filter = pivot_t[col] == 1
23
  spices[col] = pivot_t[filter].index.to_list()
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
- option = st.selectbox(
27
- 'How would you like to be contacted?',cuisines.keys())
28
 
29
- st.write('The top 10 ingredients in this cuisine are:', cuisines[option])
30
 
31
 
32
  # Create a graph
 
2
  import plotly.graph_objects as go
3
  import networkx as nx
4
  import pandas as pd
 
5
  st.set_page_config(layout="wide")
 
 
 
 
6
 
7
+ # Load and process data
8
+ df = pd.read_csv('spices_by_cuisine_with_all_flavors.csv', index_col=0)
9
  pivot = df.drop(columns=['Flavor Description']).sort_index()
10
 
11
  cuisines = {}
 
19
  filter = pivot_t[col] == 1
20
  spices[col] = pivot_t[filter].index.to_list()
21
 
22
+ st.title('Spices Across Cuisines')
23
+
24
+ col1, col2, col3 = st.columns(3)
25
+
26
+ with col1:
27
+ option = st.selectbox(
28
+ 'Select a cuisine to view the top 10 spices',cuisines.keys())
29
+ st.write('The top 10 ingredients in this cuisine are:', cuisines[option])
30
+
31
+ with col2:
32
+ option = st.selectbox(
33
+ 'Select a spice to view what cuisine it is present in',spices.keys())
34
+ st.write('It is part of the following cuisines::', spices[option])
35
+
36
+ with col3:
37
+ st.header("An owl")
38
+ st.image("https://static.streamlit.io/examples/owl.jpg")
39
 
 
 
40
 
 
41
 
42
 
43
  # Create a graph