Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- Dockerfile.txt +13 -0
- app.py +12 -0
Dockerfile.txt
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
RUN apt-get update && apt-get install -y git-lfs && git lfs install
|
| 6 |
+
|
| 7 |
+
COPY requirements.txt .
|
| 8 |
+
|
| 9 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 10 |
+
|
| 11 |
+
COPY app.py .
|
| 12 |
+
|
| 13 |
+
CMD ["python", "app.py"]
|
app.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
corrector = pipeline(task="text2text-generation", model="pszemraj/flan-t5-large-grammar-synthesis")
|
| 4 |
+
|
| 5 |
+
def grammar_corrector(sentence):
|
| 6 |
+
result = corrector(sentence)
|
| 7 |
+
return result[0]['generated_text']
|
| 8 |
+
|
| 9 |
+
interface = gr.Interface(fn=grammar_corrector, inputs=gr.Textbox(placeholder= "Type or paste your sentence", lines = 2, max_lines=5), outputs=gr.Textbox(lines = 3),
|
| 10 |
+
title="Grammar Suggestion App")
|
| 11 |
+
|
| 12 |
+
interface.launch(server_name="0.0.0.0", server_port=7860)
|