https://github.com/injusmol/translator-ios-app
A Swift-based iOS app translating French to English with Hugging Face's NLP models. Powered by Python and PyTorch.
https://github.com/injusmol/translator-ios-app
flask ios python pytorch rest-api swift translator-app
Last synced: about 2 months ago
JSON representation
A Swift-based iOS app translating French to English with Hugging Face's NLP models. Powered by Python and PyTorch.
- Host: GitHub
- URL: https://github.com/injusmol/translator-ios-app
- Owner: InjuSmol
- Created: 2024-07-18T07:32:31.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-14T22:32:21.000Z (about 1 year ago)
- Last Synced: 2025-04-14T23:29:53.708Z (about 1 year ago)
- Topics: flask, ios, python, pytorch, rest-api, swift, translator-app
- Language: Swift
- Homepage:
- Size: 30.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# French to English Translator IOS APP
This is a simple French-to-English translator iOS mobile application powered by Python, Flask, and the Hugging Face `transformers` library. Uses natural language processing (NLP) powered by a Python backend. The translation is handled by a model from the Hugging Face Transformers library.
## Technologies Used
- Swift: For the iOS mobile application development.
- Python: For the backend server.
- Flask: A lightweight WSGI web application framework for the backend API.
- Transformers: Hugging Face library for NLP tasks.
- PyTorchFor running the translation model.
- REST API
## Installation and Running Instructions
### Prerequisites
- Xcode for iOS development.
- Python 3.7 or later
- pip3 (Python package installer)
### Setup
1. **Clone the repository:**
```sh
git clone git@github.com:InjuSmol/Translator-IOS-App.git
cd translator
2. **Create a virtual environment (optional but recommended):**
```sh
python3 -m venv myenv
source myenv/bin/activate # On Windows use `myenv\Scripts\activate`
```
3. **Install the required packages:**
```sh
pip3 install flask torch transformers
```
### Running the Application
1. **Start the Flask server:**
```sh
python3 translator.py
```
2. **Test the API Endpoint:**
You can use a tool like `curl` or Postman to send a POST request to your Flask server to test the translation.
**Using `curl`:**
```sh
curl -X POST http://localhost:5000/translate -H "Content-Type: application/json" -d '{"text": "Bonjour"}'
```
This should return a JSON response with the translated text:
```json
{
"translated_text": "Hello"
}
```
### iOS Application Setup
1. **Open the project in Xcode:**
Open the `FrenchToEnglishTranslator.xcodeproj` file in Xcode.
2. **Modify the backend URL:**
Ensure the URL in your Swift code points to the Flask server's address (e.g., `http://localhost:5000/translate`).
3. **Build and run the iOS application on a simulator or device.**
## Improvements Needed
- **Reverse Translation:** Enable English->French Translation.
- **Complex Phrases and Sentences: Allow the translator to handle more complex tasks.
- **Model Optimization:** Optimize the translation model for faster performance and lower resource consumption.
- **Offline Mode:** Implement offline translation capabilities using on-device models.
- **Error Handling:** Implement better error handling for various edge cases, such as empty input text, invalid input format, etc.
- **Frontend User Interface:** Develop a frontend UI for the application using a framework like React or Angular.
- **Model Optimization:** Optimize the model loading and inference process for faster response times.
- **Dockerization:** Dockerize the application for easier deployment and scalability.
- **Authentication:** Add user authentication and authorization to secure the API endpoints.