Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shrutisangwan07/flask-text-translator-main


https://github.com/shrutisangwan07/flask-text-translator-main

Last synced: 9 days ago
JSON representation

Awesome Lists containing this project

README

        

# Build an AI web app to translate text with Flask

## Learn module

[Build an AI web app by using Python and Flask](https://docs.microsoft.com/learn/modules/python-flask-build-ai-web-app/?WT.mc_id=academic-56258-chrhar)

## Goals

We will discuss using a Cognitive Service to access text translation in a web app.

| **Goal** | Description |
| ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| **What will you learn** | How to create a Flask application, create a Translator service on Azure, and use requests to call the service. |
| **What you'll need** | [Python](https://docs.microsoft.com/learn/modules/python-install-vscode/?WT.mc_id=academic-56258-chrhar) and [Visual Studio Code](https://code.visualstudio.com?WT.mc_id=academic-56258-chrhar) | |

## Prerequisites

- [Python](https://docs.microsoft.com/learn/modules/python-install-vscode/?WT.mc_id=academic-56258-chrhar)
- [Visual Studio Code](https://code.visualstudio.com?WT.mc_id=academic-56258-chrhar)

Have you ever wanted to incorporate artificial intelligence into a website? Do you want to be able to translate text in your web apps? With Cognitive Services and Flask you can create a website to translate text with a small amount of code.

## Workflow

### Setup your environment

Start by configuring their environments (https://docs.microsoft.com/learn/modules/python-flask-build-ai-web-app/1-exercise-set-up-environment?WT.mc_id=academic-56258-chrhar). Install the necessary tooling, create the folder for your project, and set up the necessary Python libraries.

### Create the app

After setting up the environment, create the project (https://docs.microsoft.com/learn/modules/python-flask-build-ai-web-app/3-exercise-create-app?WT.mc_id=academic-56258-chrhar). Create the template for the landing page and test your application is running correctly.

### Create the Translator service

Once the project is up and running, create the necessary services on Azure (https://docs.microsoft.com/learn/modules/python-flask-build-ai-web-app/5-exercise-create-translator-service?WT.mc_id=academic-56258-chrhar). obtain the necessary keys to call the service, and properly store them in a **.env** file.

### Call the service from the app

Now add the code to call the Translator service (https://docs.microsoft.com/learn/modules/python-flask-build-ai-web-app/6-exercise-call-translator?WT.mc_id=academic-56258-chrhar). TFinish by testing your application and seeing text translated in their app!

## Practice

Now that you know how to make a web app that can translate text, what other apps can you build? Think of a use case for these translations and see how you can enhance this app. Can you add a voice element to the app, so that you can speak into a microphone, have it transcribed, and then translated using the dropdown?