LearnData Branding (5).png

How to Build a Language Translator Application with Strapi, Streamlit, and Hugging Face Models

If you're building a cool side project or an MVP, you must store user and application content. This article will teach you about Strapi, a headless CMS you can use as your application backend. You will build a language translator application using Streamlit and a language translation model from Hugging Face that allows users to translate text written in any language to English, using Strapi as a back-end to store user inputs and outputs.

Benefits of a Language Translator Application

A language translator application is handy, especially when you come across texts online that you need help understanding because you are unfamiliar with the language. It can also serve as an educational tool, improving your understanding of foreign languages by learning through provided translations. Here is a demo of the language translator application you will build in this tutorial.

upload_b32d.gif

upload_.gif

Prerequisites

Before starting, ensure you have;

Set up the Project Directory

  1. On your terminal, create a new project language_translator.

    $ mkdir language_translator
    
    
  2. Inside the project directory, create a Python virtual environment. This environment maintains the library versions used in your code, ensuring your code is reproducible every time it runs.

    $ python -m venv venv
    
    

    The first venv command creates a virtual environment, while the second venv specifies the name of your virtual environment, which you can give any name you like. After running the above command, a venv folder should be created in your project directory.

    image.png

  3. Run the following code to activate the virtual environment and start working on it.

    $ ./venv/Scripts/Activate
    
    

    Upon activation, you should see the name of your virtual environment in green, signifying that you are already in a virtual environment.

    image.png