awacke1 commited on
Commit
7194f0d
·
1 Parent(s): dbfa391

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -19,13 +19,10 @@ if st.button('Regenerate Quotes'):
19
  quotes_random = quotes.sample(10)
20
  st.write(quotes_random)
21
 
22
- #add three search buttons to search the dataframe columns
23
- search_quote = st.text_input(label='Search Quote')
24
- search_author = st.text_input(label='Search Author')
25
- search_category = st.text_input(label='Search Category')
26
-
27
- if st.button('Search'):
28
- quotes_search = quotes[quotes['quote'].str.contains(search_quote, case=False)]
29
- quotes_search1 = quotes_search[quotes_search['author'].str.contains(search_author, case=False)]
30
- quotes_search2 = quotes_search1[quotes_search1['category'].str.contains(search_category, case=False)].head(1000)
31
- st.write(quotes_search2)
 
19
  quotes_random = quotes.sample(10)
20
  st.write(quotes_random)
21
 
22
+
23
+ search_term = st.text_input(label='Search Term', value='courage')
24
+
25
+ if st.button('Search Quotes'):
26
+ results = df.query('quote == @search_term')
27
+ results = results.sample(n=10)
28
+ st.write(results)