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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -5,18 +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
  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.")
 
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
+ found = False
16
  for example in dataset["train"]:
17
+ if question.lower() in example["word"].lower():
18
+ st.write("Definition:", example["gloss"])
19
+ found = True
20
+ break
21
+ if not found:
 
22
  st.write("Sorry, the answer to your question is not available.")