Skip to content

guiziii/Translation-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Translation API

A lightweight REST API built with Flask that provides text translation functionality via HTTP endpoints.

Designed as a minimal microservice, this project allows applications to send text and receive translated content in response. It is simple, deployable, and easy to integrate into frontend or backend systems.


🚀 Features

  • RESTful translation endpoint
  • Lightweight Flask architecture
  • JSON-based request/response
  • Easy local setup
  • Procfile support for cloud deployment
  • Ready for integration with frontend or external services

📦 Requirements

  • Python 3.9+
  • pip

🛠 Installation

  1. Clone the repository:
git clone <your-repository-url>
cd flask-main
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate   # macOS/Linux
# venv\Scripts\activate    # Windows
  1. Install dependencies:
pip install -r requirements.txt

▶️ Running Locally

python main.py

The API will start at:

http://localhost:5000

📡 Example Usage

Request

POST /translate
Content-Type: application/json

{
  "text": "Hello world",
  "source_language": "en",
  "target_language": "pt"
}

Response

{
  "translated_text": "Olá mundo"
}

🧪 Development Mode

export FLASK_ENV=development
export FLASK_APP=main.py
flask run

🌐 Deployment

This project includes a Procfile, allowing deployment on:

  • Heroku
  • Railway
  • Render
  • Other Procfile-compatible PaaS platforms

Example deployment:

git push heroku main

📁 Project Structure

flask-main/
│
├── main.py          # Application entry point
├── requirements.txt # Dependencies
├── Procfile         # Deployment configuration
└── .gitignore

🔒 Security Notes

  • Store API keys using environment variables
  • Do not commit secrets
  • Use a production WSGI server (e.g., Gunicorn) for deployment

About

Translation API is a lightweight RESTful service built with Flask that provides text translation capabilities through a simple HTTP interface. Designed for fast deployment and minimal setup, it serves as a backend microservice for applications requiring language translation functionality.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors