Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,20 +1,14 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
# Load
|
| 5 |
pipe = pipeline("text-generation", model="mrm8488/t5-base-finetuned-common_gen")
|
| 6 |
|
| 7 |
-
# Define
|
| 8 |
-
def
|
| 9 |
-
|
| 10 |
-
output = pipe(prompt, max_new_tokens=300, do_sample=True)[0]['generated_text']
|
| 11 |
return output
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
gr.Interface(
|
| 15 |
-
|
| 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 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|