Alloire commited on
Commit
02c8640
·
verified ·
1 Parent(s): ada0cb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -5,17 +5,18 @@ from datasets import load_dataset
5
  dataset = load_dataset("marksverdhei/wordnet-definitions-en-2021")
6
 
7
  # Streamlit app
8
- st.title("TouchDown Buddy Chatbot")
9
 
10
  # Input question
11
  question = st.text_input("Enter your question:")
12
 
13
  # Search for the corresponding definition
14
  if question:
15
- definitions = dataset["train"].filter(lambda example: question.lower() in example["gloss"].lower())
16
- if len(definitions) > 0:
17
- st.write("Definitions:")
18
- for i, definition in enumerate(definitions):
19
- st.write(f"{i+1}. {definition['gloss']}")
 
20
  else:
21
  st.write("Sorry, the answer to your question is not available.")
 
5
  dataset = load_dataset("marksverdhei/wordnet-definitions-en-2021")
6
 
7
  # Streamlit app
8
+ st.title("Touchdown Buddy Chatbot")
9
 
10
  # Input question
11
  question = st.text_input("Enter your question:")
12
 
13
  # Search for the corresponding definition
14
  if question:
15
+ for example in dataset["train"]:
16
+ if "definition" in example:
17
+ definitions = example["definition"]
18
+ if question.lower() in definitions.lower():
19
+ st.write("Definition:", definitions)
20
+ break
21
  else:
22
  st.write("Sorry, the answer to your question is not available.")