Spaces:
Sleeping
Sleeping
Commit
Β·
c75ef3b
1
Parent(s):
42bee4e
Update code: updated docker compose and main py file adding cache atenrate
Browse files- README.md +0 -16
- paragraph_checker.py +4 -1
README.md
CHANGED
|
@@ -8,19 +8,3 @@ sdk_version: "3.8.2"
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
-
|
| 12 |
-
# π Convomate Paragraph Checker
|
| 13 |
-
|
| 14 |
-
This Space runs a Flask app for grammar and tense correction using:
|
| 15 |
-
|
| 16 |
-
- `language_tool_python` for grammar fixes
|
| 17 |
-
- T5 Transformer (`Vamsi/T5_Paraphrase_Paws`) for tense rewriting
|
| 18 |
-
|
| 19 |
-
### π How to Use
|
| 20 |
-
|
| 21 |
-
Send a POST request to `/correct_text` with:
|
| 22 |
-
|
| 23 |
-
```json
|
| 24 |
-
{
|
| 25 |
-
"paragraph": "your incorrect sentence here"
|
| 26 |
-
}
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
paragraph_checker.py
CHANGED
|
@@ -1,5 +1,8 @@
|
|
| 1 |
import os
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
import language_tool_python
|
| 5 |
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
|
|
|
| 1 |
import os
|
| 2 |
+
# Set writable cache paths for both Hugging Face and LanguageTool
|
| 3 |
+
os.environ['TRANSFORMERS_CACHE'] = '/app/cache'
|
| 4 |
+
os.environ['HF_HOME'] = '/app/cache'
|
| 5 |
+
os.environ['LANGTOOL_HOME'] = '/app/cache/langtool'
|
| 6 |
|
| 7 |
import language_tool_python
|
| 8 |
from transformers import T5ForConditionalGeneration, T5Tokenizer
|