Vivek12345323 commited on
Commit
4c121be
·
verified ·
1 Parent(s): 0be76f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -13
app.py CHANGED
@@ -1,20 +1,14 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Load the Hugging Face model
5
  pipe = pipeline("text-generation", model="mrm8488/t5-base-finetuned-common_gen")
6
 
7
- # Define what the app does
8
- def rewrite(text):
9
- prompt = f"Fix grammar and improve clarity for this text:\n\n{text}"
10
- output = pipe(prompt, max_new_tokens=300, do_sample=True)[0]['generated_text']
11
  return output
12
 
13
- # Create the interface
14
- gr.Interface(
15
- fn=rewrite,
16
- inputs=gr.Textbox(lines=10, placeholder="Paste your essay here..."),
17
- outputs=gr.Textbox(lines=10, label="Improved Essay"),
18
- title="AI Essay Rewriter",
19
- description="Paste an essay or paragraph and get an improved version using Mistral-7B."
20
- ).launch()
 
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="mrm8488/t5-base-finetuned-common_gen")
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
+