File size: 2,138 Bytes
c9a4754
81b96a3
 
 
 
 
 
 
c9a4754
81b96a3
c9a4754
81b96a3
 
 
c9a4754
81b96a3
 
 
c9a4754
81b96a3
 
c9a4754
81b96a3
 
 
 
c9a4754
81b96a3
 
 
 
 
c9a4754
d0b7696
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
title: English to French Translator
emoji: 🌍
colorFrom: indigo
colorTo: purple
sdk: gradio
sdk_version: 5.29.0
app_file: app.py
pinned: true
license: apache-2.0
hardware:
  accelerator: CPU
  cpu: '2'
  memory: 8GB
env:
- name: HF_TOKEN
  description: Hugging Face API token for private models
  required: false
datasets:
- opus_books
- wmt14
custom:
  progress: 'true'
  timeout: 300
  docker:
    parent_space: username/space-name
tags:
- translation
- nlp
- t5
- multilingual
- huggingface
---
# 🌍 English-to-French Translation App

A Gradio web interface for translating English text to French using Hugging Face's T5 transformer models.

Encoder-Decoder Transformers (e.g., T5, BART, mT5) are comonly used for translation, summarization, question answering.
They combine both encoder and decoder for input-output mappings.


## Features

- **Model Selection**: Choose between different T5 model sizes
  - `t5-small`: Faster inference
  - `t5-base`: Higher quality translations
- **Customizable Length**: Control maximum translation output length
- **Example Texts**: Try pre-loaded examples with one click
- **Responsive Design**: Works on both desktop and mobile devices

## How to Use

1. **Input Text**:
   - Type or paste English text in the input box
2. **Select Model**:
   - Choose your preferred balance of speed vs quality
3. **Adjust Length** (Optional):
   - Use the slider to control translation length
4. **Click Translate**:
   - Get instant French translation

## Technical Details

### Models Used
- [T5-small](https://huggingface.co/t5-small) (60M parameters)
- [T5-base](https://huggingface.co/t5-base) (220M parameters)

### Dependencies
- Transformers >=4.30.0
- PyTorch >=1.10.0
- Gradio >=3.40.0
- SentencePiece (for tokenization)

## Deployment

This app is designed for easy deployment on [Hugging Face Spaces](https://huggingface.co/spaces):

1. Create a new Space
2. Add these files:
   - `app.py` (main application)
   - `requirements.txt` (dependencies)
3. The Space will automatically build and deploy

## Local Development

To run locally:
```bash
pip install -r requirements.txt
python app.py