Spaces:
Running
Running
Fix Hugging Face Space configuration and app setup
Browse files- Added proper YAML frontmatter to README.md for Hugging Face Spaces
- Renamed main.py → app.py for correct entrypoint
- Updated requirements.txt with required dependencies
- Ensured configuration points to the right app file
- Prepared Smooth Paraphraser for stable deployment on Hugging Face
- README.md +23 -10
- app.py +8 -6
- requirements.txt +3 -1
README.md
CHANGED
@@ -1,14 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Smooth Paraphraser
|
2 |
|
3 |
-
|
|
|
4 |
|
5 |
## Features
|
6 |
-
-
|
7 |
-
-
|
8 |
-
-
|
9 |
-
|
10 |
-
##
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
1 |
+
---
|
2 |
+
title: Smooth Paraphraser
|
3 |
+
emoji: 📝
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: blue
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: "4.29.0"
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
---
|
11 |
+
|
12 |
# Smooth Paraphraser
|
13 |
|
14 |
+
A lightweight web app that rewrites text smoothly while preserving meaning.
|
15 |
+
Built with **Gradio + Transformers**, deployed on **Hugging Face Spaces**.
|
16 |
|
17 |
## Features
|
18 |
+
- Paraphrase sentences, paragraphs, or articles.
|
19 |
+
- Uses state-of-the-art T5 model.
|
20 |
+
- Simple and responsive UI.
|
21 |
+
|
22 |
+
## Usage
|
23 |
+
1. Enter text in the input box.
|
24 |
+
2. Click **Paraphrase**.
|
25 |
+
3. Copy the rewritten text.
|
26 |
+
|
27 |
+
---
|
app.py
CHANGED
@@ -1,21 +1,23 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# Load
|
5 |
paraphraser = pipeline("text2text-generation", model="Vamsi/T5_Paraphrase_Paws")
|
6 |
|
7 |
def paraphrase(text):
|
8 |
-
|
|
|
|
|
9 |
return result[0]['generated_text']
|
10 |
|
11 |
# Gradio interface
|
12 |
-
|
13 |
fn=paraphrase,
|
14 |
-
inputs=gr.Textbox(lines=4, placeholder="Enter text
|
15 |
outputs="text",
|
16 |
title="Smooth Paraphraser",
|
17 |
-
description="
|
18 |
)
|
19 |
|
20 |
if __name__ == "__main__":
|
21 |
-
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Load 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 some text."
|
10 |
+
result = paraphraser(text, max_length=128, num_return_sequences=1, do_sample=False)
|
11 |
return result[0]['generated_text']
|
12 |
|
13 |
# Gradio interface
|
14 |
+
iface = gr.Interface(
|
15 |
fn=paraphrase,
|
16 |
+
inputs=gr.Textbox(lines=4, placeholder="Enter text here..."),
|
17 |
outputs="text",
|
18 |
title="Smooth Paraphraser",
|
19 |
+
description="Rewrite sentences smoothly while preserving meaning."
|
20 |
)
|
21 |
|
22 |
if __name__ == "__main__":
|
23 |
+
iface.launch()
|
requirements.txt
CHANGED
@@ -1,3 +1,5 @@
|
|
1 |
-
transformers==4.
|
2 |
torch
|
3 |
gradio==4.29.0
|
|
|
|
|
|
1 |
+
transformers==4.39.3
|
2 |
torch
|
3 |
gradio==4.29.0
|
4 |
+
sentencepiece
|
5 |
+
tiktoken
|