Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,8 +24,22 @@ theme = gr.themes.Soft(
|
|
| 24 |
with open("essay_writing.txt", "r", encoding="utf-8") as f:
|
| 25 |
essay_writing = f.read()
|
| 26 |
|
|
|
|
|
|
|
|
|
|
| 27 |
# split the text into chunks
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
# load an embedding model
|
| 31 |
model = SentenceTransformer('all-MiniLM-L6-v2')
|
|
|
|
| 24 |
with open("essay_writing.txt", "r", encoding="utf-8") as f:
|
| 25 |
essay_writing = f.read()
|
| 26 |
|
| 27 |
+
with open("STAAR_essay.txt", "r", encoding="utf-8") as file:
|
| 28 |
+
staar_essay = file.read()
|
| 29 |
+
|
| 30 |
# split the text into chunks
|
| 31 |
+
def preprocess_text(text):
|
| 32 |
+
cleaned_text = text.strip()
|
| 33 |
+
chunks = cleaned_text.split("\n")
|
| 34 |
+
cleaned_chunks = []
|
| 35 |
+
for chunk in chunks:
|
| 36 |
+
stripped_chunk = chunk.strip()
|
| 37 |
+
cleaned_chunks.append(stripped_chunk)
|
| 38 |
+
return cleaned_chunks
|
| 39 |
+
|
| 40 |
+
essay_chunks = preprocess_text(essay_writing)
|
| 41 |
+
staar_chunks = preprocess_text(staar_essay)
|
| 42 |
+
essay_chunks.extend(staar_chunks)
|
| 43 |
|
| 44 |
# load an embedding model
|
| 45 |
model = SentenceTransformer('all-MiniLM-L6-v2')
|