Spaces:
Runtime error
Runtime error
"~"
Browse files- README.md +27 -42
- app.py +1 -1
- requirements.txt +1 -0
README.md
CHANGED
|
@@ -10,65 +10,50 @@ pinned: false
|
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
-
# Text Summarization
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
##
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
##
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
| 26 |
|
| 27 |
-
|
| 28 |
-
- Hugging Face Transformers
|
| 29 |
-
- Gradio
|
| 30 |
|
| 31 |
-
|
| 32 |
|
| 33 |
-
|
| 34 |
-
pip install transformers gradio
|
| 35 |
-
```
|
| 36 |
|
| 37 |
-
### Installation
|
| 38 |
|
| 39 |
-
|
| 40 |
-
```shell
|
| 41 |
-
# Make sure you have git-lfs installed (https://git-lfs.com)
|
| 42 |
-
git lfs install
|
| 43 |
-
git clone https://huggingface.co/spaces/xjlulu/summarization
|
| 44 |
|
| 45 |
-
|
| 46 |
-
# prepend your git clone with the following env var:
|
| 47 |
-
GIT_LFS_SKIP_SMUDGE=1
|
| 48 |
-
```
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
3. Run the application:
|
| 55 |
-
```shell
|
| 56 |
-
python app.py
|
| 57 |
-
```
|
| 58 |
|
| 59 |
-
|
| 60 |
|
| 61 |
-
|
| 62 |
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
|
| 67 |
-
|
| 68 |
|
| 69 |
-
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
This project is licensed under the [Apache License 2.0](LICENSE). See the [LICENSE](LICENSE) file for details.
|
| 74 |
|
|
|
|
|
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# Text Summarization Hugging Face Spaces App
|
| 14 |
|
| 15 |
+
Welcome to the Text Summarization Hugging Face Spaces App! This app allows you to generate text titles using the XJLULU/NTU_ADL_SUMMARIZATION_MT5_S model.
|
| 16 |
|
| 17 |
+
## App Description
|
| 18 |
|
| 19 |
+
This app takes a piece of text as input and generates a summary of the text. You can either enter your own text or click the "Random" button to get a random example from a provided dataset and generate a summary.
|
| 20 |
|
| 21 |
+
## How to Use
|
| 22 |
|
| 23 |
+
1. Enter or paste a piece of text into the "Context paragraph" textbox.
|
| 24 |
+
2. Click the "Generate" button to generate a summary.
|
| 25 |
+
3. You can also click the "Random" button to generate a random example for summarization.
|
| 26 |
|
| 27 |
+
## Example Data
|
| 28 |
|
| 29 |
+
The app uses a dataset of examples provided in the `sample_data.jsonl` file. Each example in the dataset contains a "text" field. You can either provide your own text or use the "Random" button to choose an example from the dataset.
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
## Model Information
|
| 32 |
|
| 33 |
+
This project uses the `xjlulu/ntu_adl_summarization_mt5_s` model from Hugging Face.
|
|
|
|
|
|
|
| 34 |
|
|
|
|
| 35 |
|
| 36 |
+
## Local Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
If you want to run this app locally, follow these steps:
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
1. Clone the repository: `git clone https://huggingface.co/spaces/xjlulu/summarization`
|
| 41 |
+
2. Navigate to the project directory: `cd summarization`
|
| 42 |
+
3. Install the required libraries: `pip install -r requirements.txt`
|
| 43 |
+
4. Run the app: `python app.py`
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
+
The app will start locally and be accessible at `http://localhost:7860`. You can access it in your web browser.
|
| 46 |
|
| 47 |
+
## Credits
|
| 48 |
|
| 49 |
+
- [Hugging Face Transformers](https://github.com/huggingface/transformers)
|
| 50 |
+
- [Gradio](https://gradio.app/)
|
| 51 |
+
- [apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
| 52 |
|
| 53 |
+
## License
|
| 54 |
|
| 55 |
+
This project is licensed under the apache-2.0 - see the [apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) file for details.
|
| 56 |
|
| 57 |
+
## Acknowledgments
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
Thank you to the open-source community for developing the amazing tools and libraries that make this project possible.
|
app.py
CHANGED
|
@@ -26,7 +26,7 @@ with gr.Blocks(theme=gr.themes.Soft(), title="Text Summarization") as demo:
|
|
| 26 |
gr.Markdown(description)
|
| 27 |
|
| 28 |
C_input = gr.Textbox(lines=12, label="Context paragraph")
|
| 29 |
-
S_output = Textbox(lines=3, label="
|
| 30 |
with gr.Row():
|
| 31 |
random_button = gr.Button("Random")
|
| 32 |
generate_button = gr.Button("Generate")
|
|
|
|
| 26 |
gr.Markdown(description)
|
| 27 |
|
| 28 |
C_input = gr.Textbox(lines=12, label="Context paragraph")
|
| 29 |
+
S_output = Textbox(lines=3, label="title")
|
| 30 |
with gr.Row():
|
| 31 |
random_button = gr.Button("Random")
|
| 32 |
generate_button = gr.Button("Generate")
|
requirements.txt
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
text-generation==0.6.0
|
| 2 |
transformers==4.31.0
|
|
|
|
| 3 |
pymongo==4.4.1
|
| 4 |
torch
|
| 5 |
sentencepiece
|
|
|
|
| 1 |
text-generation==0.6.0
|
| 2 |
transformers==4.31.0
|
| 3 |
+
gradio
|
| 4 |
pymongo==4.4.1
|
| 5 |
torch
|
| 6 |
sentencepiece
|