Spaces:
Runtime error
Runtime error
Commit
·
f5ebbcb
1
Parent(s):
bcf327a
Update app.py
Browse files
app.py
CHANGED
@@ -28,7 +28,7 @@ def grammar_sense(sentence):
|
|
28 |
})
|
29 |
objects = ["Sense", "Grammar"]
|
30 |
ans = []
|
31 |
-
for i
|
32 |
if i == "Sense":
|
33 |
response_data = json.loads(json.dumps(sense))
|
34 |
labels = response_data['labels']
|
@@ -59,10 +59,10 @@ st.title("NLP Testing and Scoring App")
|
|
59 |
topic = st.text_input("Enter a topic (optional):")
|
60 |
|
61 |
# Web scraping and text cleaning
|
62 |
-
entity =
|
63 |
prefix = "https://wiki.kidzsearch.com/wiki/"
|
64 |
page = requests.get(f'{prefix}{entity}')
|
65 |
-
res = BeautifulSoup(page
|
66 |
|
67 |
text = [i.get_text() for i in res.find_all('p')]
|
68 |
|
@@ -109,7 +109,7 @@ class SubjectiveTest:
|
|
109 |
for sentence in doc.sents:
|
110 |
for ent in sentence.ents:
|
111 |
entity_label = ent.label_
|
112 |
-
entity_text = ent
|
113 |
question_patterns = self.adjust_question_pattern(entity_label, topic is not None)
|
114 |
for pattern in question_patterns:
|
115 |
question = pattern.format(entity=entity_text, topic=topic)
|
@@ -120,7 +120,7 @@ class SubjectiveTest:
|
|
120 |
|
121 |
questions = []
|
122 |
|
123 |
-
for entity_label, entity_questions in question_answer_dict.items
|
124 |
entity_questions = entity_questions[:self.noOfQues]
|
125 |
questions.extend(entity_questions)
|
126 |
|
@@ -143,6 +143,12 @@ if st.button("Submit"):
|
|
143 |
scores = []
|
144 |
client = Client("https://billbojangeles2000-zephyr-7b-alpha-chatbot-karki.hf.space/")
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
for i, question in enumerate(questions):
|
147 |
res = answers[f'Q{i + 1}']
|
148 |
if res:
|
|
|
28 |
})
|
29 |
objects = ["Sense", "Grammar"]
|
30 |
ans = []
|
31 |
+
for i:
|
32 |
if i == "Sense":
|
33 |
response_data = json.loads(json.dumps(sense))
|
34 |
labels = response_data['labels']
|
|
|
59 |
topic = st.text_input("Enter a topic (optional):")
|
60 |
|
61 |
# Web scraping and text cleaning
|
62 |
+
entity = "Florida"
|
63 |
prefix = "https://wiki.kidzsearch.com/wiki/"
|
64 |
page = requests.get(f'{prefix}{entity}')
|
65 |
+
res = BeautifulSoup(page content, 'html parser')
|
66 |
|
67 |
text = [i.get_text() for i in res.find_all('p')]
|
68 |
|
|
|
109 |
for sentence in doc.sents:
|
110 |
for ent in sentence.ents:
|
111 |
entity_label = ent.label_
|
112 |
+
entity_text = ent text
|
113 |
question_patterns = self.adjust_question_pattern(entity_label, topic is not None)
|
114 |
for pattern in question_patterns:
|
115 |
question = pattern.format(entity=entity_text, topic=topic)
|
|
|
120 |
|
121 |
questions = []
|
122 |
|
123 |
+
for entity_label, entity_questions in question_answer_dict.items:
|
124 |
entity_questions = entity_questions[:self.noOfQues]
|
125 |
questions.extend(entity_questions)
|
126 |
|
|
|
143 |
scores = []
|
144 |
client = Client("https://billbojangeles2000-zephyr-7b-alpha-chatbot-karki.hf.space/")
|
145 |
|
146 |
+
question_list = subjective_generator.generate_test(topic) # Define 'questions' here
|
147 |
+
questions = []
|
148 |
+
for i, question in enumerate(question_list):
|
149 |
+
if "Explain" not in question and len(tool.check(question)) == 0 and grammar_sense(question):
|
150 |
+
questions.append(f"Question: {question}")
|
151 |
+
|
152 |
for i, question in enumerate(questions):
|
153 |
res = answers[f'Q{i + 1}']
|
154 |
if res:
|