Vivek12345323 commited on
Commit
3a98369
·
verified ·
1 Parent(s): 9dc2b9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -1,14 +1,12 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Load a free, public text-generation model
5
- pipe = pipeline("text-generation",model = "prithivida/grammar_error_correcter_v1")
6
 
7
- # Define your function
8
  def respond(prompt):
9
- output = pipe(prompt, max_new_tokens=50)[0]['generated_text']
10
- return output
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