Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
6.1.0
metadata
title: Multipurpose NLP Web App
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 all‑in‑one Translation + Summarization app:
- Translation: facebook/m2m100_418M (~100 languages)
- Summarization: sshleifer/distilbart-cnn-12-6 (English)
Deploy in 3 minutes
- Create a Space: https://huggingface.co/new-space
- Space SDK:
Gradio - Hardware: CPU Basic is fine (bigger models may load slower).
- Space SDK:
- Upload these three files:
app.py,requirements.txt,languages.json. - Commit → The Space will build and start. No secrets needed.
Features
- Two tabs: Translate and Summarize
- Dropdowns for source/target languages (common ~45 languages pre‑mapped)
- Adjustable generation lengths
- Example inputs to test quickly
Notes
- M2M100 requires setting
src_langand aforced_bos_token_idfor the target language; handled for you inapp.py. - Summarization is English‑focused for speed. If you need multilingual summaries, swap the model in
app.pyfor an mT5‑based XLSum model (e.g.,csebuetnlp/mT5_multilingual_XLSum) and addsentencepiece(already included).
Optional: Multilingual Summarization
Replace the summarizer lines in app.py with:
SUM_MODEL_NAME = "csebuetnlp/mT5_multilingual_XLSum"
summarizer = pipeline("summarization", model=SUM_MODEL_NAME, tokenizer=SUM_MODEL_NAME)
Built for assignments and demos. Enjoy!