File size: 3,497 Bytes
fecb5a0
 
 
 
 
 
 
 
 
 
 
 
67a1108
 
 
 
 
 
fecb5a0
e256393
 
67a1108
 
 
 
 
e256393
 
 
67a1108
e256393
67a1108
 
 
 
 
 
 
 
 
e256393
 
 
67a1108
e256393
67a1108
 
 
 
 
 
 
 
 
 
e256393
 
 
67a1108
e256393
 
67a1108
 
 
e256393
 
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
58
59
60
61
62
63
64
65
66
67
---
title: Speechtranslate
emoji: 🏆
colorFrom: red
colorTo: yellow
sdk: gradio
sdk_version: 5.31.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: text2speech+translate
---

# 🌐💬 Translate & Speak + Session Log  
[![Hugging Face Space](https://img.shields.io/badge/HuggingFace-Spaces-blue?logo=huggingface)](https://huggingface.co/spaces/your-username/translate-speak-log)  
[![Gradio UI](https://img.shields.io/badge/Gradio-5.31.0-brightgreen?logo=gradio)](https://gradio.app)  
[![Python](https://img.shields.io/badge/Python-3.10-yellow?logo=python)](https://www.python.org/)  
[![License](https://img.shields.io/badge/License-MIT-lightgrey)](LICENSE)  

---

## 🚀 Overview  
Harness the power of **real-time NLP**, **on-the-fly translation**, and **neural TTS** in one elegant, CPU-only pipeline. This Space transforms user text into spoken audio—any English or Spanish input gets auto-detected, translated, and voiced back—while maintaining a live session log for data-driven insights.

**Key AI buzzwords:**  
> Natural Language Processing (NLP) • Neural Text-to-Speech • Zero-shot language detection • Real-time inference • Session state management • Cloud-native deployment • User-centric design • Cost-efficient CPU runtime

---

## ✨ Features

| 🔑 Feature                     | 🔍 Description                                                                                             |
|--------------------------------|-------------------------------------------------------------------------------------------------------------|
| **🔄 Bidirectional Translation** | English ↔ Spanish via `deep-translator`’s GoogleTranslator (auto-detect source language)                    |
| **🗣️ Neural TTS**               | High-fidelity speech generation with `gTTS` (Google Translate TTS)                                          |
| **🕒 Real-Time Processing**      | Sub-second response on free CPU tier—no GPUs, no paid APIs                                                  |
| **📊 Session Logging**          | Data-driven UX: every input, translation, and audio event recorded in an interactive DataFrame               |
| **🎨 Interactive UI**           | Sleek Gradio Blocks interface with controls for text input, language selector, and playback                  |
| **🔧 Zero-Config Dev**          | Drop-in `app.py` + `requirements.txt`—Spaces auto-builds and deploys                                          |
| **💡 Extensible Architecture**   | Modular pipelines—swap translators, TTS engines, or add analytics with minimal code changes                  |

---

## 🏗️ Architecture & Workflow

1. **User Input**  
   - Free-form text in any language (auto-detects English/Spanish).
2. **Translation**  
   - `deep-translator` → Google Translate API wrapper → high-accuracy text conversion.
3. **Text-to-Speech**  
   - `gTTS` → neural waveform synthesis → MP3 output.
4. **Session Log**  
   - Maintains a rolling table of `[Input, Target Language, Translated Text]` for audit trails and usage analytics.
5. **UI Rendering**  
   - Gradio Blocks orchestrates inputs, buttons, outputs, and state, delivering a seamless end-to-end experience.

---

## 🛠️ Quick Start (Local Development)

```bash
git clone https://github.com/your-username/translate-speak-log.git
cd translate-speak-log
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python app.py