awacke1 commited on
Commit
b3057ad
·
1 Parent(s): 00f3b99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -20,9 +20,21 @@ if st.button('Regenerate Quotes'):
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 = quotes.query('quote == @search_term')
27
- results = results.sample(n=10)
28
- st.write(results)
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  st.write(quotes_random)
21
 
22
 
23
+ # Load CSV File
24
+ quotes_df = pd.read_csv("quotes.csv")
25
+
26
+ # Create a search text field for each
27
+ quote = st.text_input("Quote", "courage")
28
+ author = st.text_input("Author", "courage")
29
+ category = st.text_input("Category", "courage")
30
+
31
+ # When button is clicked search and find 10 example random quotes
32
+ if st.button("Search"):
33
+ # Filtering data
34
+ quotes_df_filtered = quotes_df[
35
+ (quotes_df["quote"].str.contains(quote))
36
+ & (quotes_df["author"].str.contains(author))
37
+ & (quotes_df["category"].str.contains(category))
38
+ ][:10]
39
+ # Show the results
40
+ st.write(quotes_df_filtered)