Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
#
|
5 |
-
pipe = pipeline("
|
6 |
|
7 |
-
# Define your function
|
8 |
def respond(prompt):
|
9 |
-
|
10 |
-
return
|
11 |
|
12 |
-
# Build the interface
|
13 |
gr.Interface(fn=respond, inputs="text", outputs="text", title="Free AI Essay Bot").launch()
|
14 |
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Swap in a grammar-correction model
|
5 |
+
pipe = pipeline("text2text-generation", model="vennify/t5-base-grammar-correction")
|
6 |
|
|
|
7 |
def respond(prompt):
|
8 |
+
result = pipe(prompt, max_new_tokens=100)[0]['generated_text']
|
9 |
+
return f"Revised Essay:\n{result}\n\nExplanation:\nThe model corrected grammar, punctuation, and style based on typical English writing conventions."
|
10 |
|
|
|
11 |
gr.Interface(fn=respond, inputs="text", outputs="text", title="Free AI Essay Bot").launch()
|
12 |
|