Spaces:
Running
Running
feat: complete visual redesign of translation, voice cloning, and meeting hubs with premium layout aesthetics
6fd21b2 Download scratch/test_preprocess.py from Shalzkrish/voicebridge-backend: direct link, hf CLI and curl.
- Browser
- Download file 976 Bytes
-
https://huggingface.co/spaces/Shalzkrish/voicebridge-backend/resolve/main/scratch/test_preprocess.py
- Command line
-
hf download hf://spaces/Shalzkrish/voicebridge-backend/scratch/test_preprocess.py
-
curl -L -o test_preprocess.py https://huggingface.co/spaces/Shalzkrish/voicebridge-backend/resolve/main/scratch/test_preprocess.py
976 Bytes
| import sys | |
| import os | |
| sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) | |
| from app.services.translation.indictrans_service import IndicTransTranslationService | |
| service = IndicTransTranslationService() | |
| service.load_model() | |
| p1 = "The popular voice speaks about the landowners, Mafia people, and the representatives of the" | |
| # Let's try stripping trailing prepositions/determiners: 'of the', 'the', etc. | |
| p1_clean = "The popular voice speaks about the landowners, Mafia people, and the representatives" | |
| p2 = "conservative parties and their names are known by everyone." | |
| # Let's try capitalizing the first letter | |
| p2_clean = p2[0].upper() + p2[1:] | |
| print("Original p1:", service.translate(p1, "en", "ta").encode("utf-8")) | |
| print("Cleaned p1:", service.translate(p1_clean, "en", "ta").encode("utf-8")) | |
| print("Original p2:", service.translate(p2, "en", "ta").encode("utf-8")) | |
| print("Cleaned p2:", service.translate(p2_clean, "en", "ta").encode("utf-8")) | |