Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,16 +1,5 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import spacy
|
| 3 |
|
| 4 |
-
# Load the spaCy English model
|
| 5 |
-
nlp = spacy.load("en_core_web_sm")
|
| 6 |
-
|
| 7 |
-
# Function to analyze and explain a sentence
|
| 8 |
-
def analyze_sentence(sentence):
|
| 9 |
-
doc = nlp(sentence)
|
| 10 |
-
explanations = []
|
| 11 |
-
for token in doc:
|
| 12 |
-
explanations.append((token.text, token.lemma_, token.pos_, spacy.explain(token.tag_)))
|
| 13 |
-
return explanations
|
| 14 |
|
| 15 |
# Streamlit app
|
| 16 |
st.title("Biology English Grammar Helper")
|
|
@@ -209,10 +198,4 @@ if tense_selected:
|
|
| 209 |
st.write(f"**Use:** {tense_info['use']}")
|
| 210 |
st.markdown("**Examples:**")
|
| 211 |
for example, explanation in tense_info['examples']:
|
| 212 |
-
st.write(f"- **{example}**: {explanation}")
|
| 213 |
-
if st.button(f'Analyze "{example}"', key=example): # Unique key for each button
|
| 214 |
-
with st.spinner('Analyzing...'):
|
| 215 |
-
explanations = analyze_sentence(example)
|
| 216 |
-
st.write("Analysis (Word, Base Form, Part of Speech, Explanation):")
|
| 217 |
-
for exp in explanations:
|
| 218 |
-
st.write(exp)
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Streamlit app
|
| 5 |
st.title("Biology English Grammar Helper")
|
|
|
|
| 198 |
st.write(f"**Use:** {tense_info['use']}")
|
| 199 |
st.markdown("**Examples:**")
|
| 200 |
for example, explanation in tense_info['examples']:
|
| 201 |
+
st.write(f"- **{example}**: {explanation}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|