Spaces:
Sleeping
Sleeping
Delete main.py
Browse files
main.py
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from transformers import pipeline
|
3 |
-
|
4 |
-
# Load paraphrasing pipeline (using T5 model)
|
5 |
-
paraphraser = pipeline("text2text-generation", model="Vamsi/T5_Paraphrase_Paws")
|
6 |
-
|
7 |
-
def paraphrase(text):
|
8 |
-
if not text.strip():
|
9 |
-
return "Please enter text to paraphrase."
|
10 |
-
result = paraphraser(text, max_length=100, num_return_sequences=1, do_sample=True)
|
11 |
-
return result[0]['generated_text']
|
12 |
-
|
13 |
-
demo = gr.Interface(
|
14 |
-
fn=paraphrase,
|
15 |
-
inputs=gr.Textbox(lines=3, placeholder="Enter text here..."),
|
16 |
-
outputs="text",
|
17 |
-
title="Paraphraser API",
|
18 |
-
description="Enter a sentence and get a paraphrased version."
|
19 |
-
)
|
20 |
-
|
21 |
-
if __name__ == "__main__":
|
22 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|