File size: 1,848 Bytes
34587ad
 
 
 
 
 
 
 
 
 
 
b8bfc68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34587ad
 
b8bfc68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
title: "Multipurpose NLP: Translation and Summarization"
emoji: "🧠"
colorFrom: "blue"
colorTo: "green"
sdk: "gradio"
sdk_version: "4.44.0"
app_file: "app.py"
pinned: false
---

# Multipurpose NLP Web App (Gradio on Hugging Face Spaces)

An interactive Gradio app offering:
- Multi-language text translation (M2M100: 100+ languages)
- Abstractive summarization in English (DistilBART CNN)

## Demo
Once deployed, your Space will be live at:
https://huggingface.co/spaces/<your-hf-username>/<your-space-name>

## Features
- Translation: Choose source and target languages from 60+ common languages (backed by M2M100’s 100+ support).
- Summarization: Abstractive summaries of long text (best for English news/articles).

## Models
- Translation: `facebook/m2m100_418M`
- Summarization: `sshleifer/distilbart-cnn-12-6`

## Quick Start (Hugging Face Spaces)
1. Log in at https://huggingface.co
2. Create a new Space:
   - Space SDK: Gradio
   - Template: Blank (Gradio)
   - Choose a name (e.g., `nlp-translate-summarize`)
   - Hardware: CPU Basic (works; translation may be slower for long inputs)
3. Upload these files:
   - `app.py`
   - `requirements.txt`
   - `README.md`
4. Wait for the build to finish. The Space will auto-start.

## Local Development (Optional)
```bash
python -m venv .venv && source .venv/bin/activate  # or .venv\Scripts\activate on Windows
pip install -r requirements.txt
python app.py
# Visit http://127.0.0.1:7860
```

## Notes & Limitations
- Translation: For very long inputs, the model truncates to fit context (about ~1k tokens). Consider shorter paragraphs for best quality.
- Summarization: The chosen model is optimized for English. Non-English texts may yield weaker results.
- CPU-only inference is supported but slower; upgrading hardware on Spaces can improve latency.

## License
MIT (adjust as needed)