Build an online translation APP based on the Transformer model

Posts
Deep leanring
APP
Author

Junchuan Yu

Published

February 27, 2023

AI-Translator

Build an online translation and grammar checking APP based on the Transformer model.

APP link: https://junchuanyu-tools.hf.space/

Interface

The AI-Translator has two interfaces, one for text translation and one for grammar checking and text generation.You can enter sentence through the interface and click the “RUN” button to get the result.

How to use API

You can realize more functions by calling the API.The api call demo is as follows:

DEMO-1: translation

import requests

response = requests.post("https://junchuanyu-tools.hf.space/run/translate_zh", json={
    "data": [
        "Build an online translation and grammar checking app.",
    ]
}).json()

data = response["data"]

print(data)

response2 = requests.post("https://junchuanyu-tools.hf.space/run/translate_en", json={
    "data": [
        "你好吗?代码男",
    ]
}).json()

data2 = response2["data"]
print(data2)

DEMO-2: grammar checker


import requests

response = requests.post("https://junchuanyu-tools.hf.space/run/gramacorrect", json={
    "data": [
        "I is jack",
    ]
}).json()

data = response["data"]
print(data)

DEMO-3: text generator

import requests

response = requests.post("https://junchuanyu-tools.hf.space/run/generator", json={
    "data": [
        "hello coding guy, i want",
    ]
}).json()

data = response["data"]

print(data)

If you want to get the downloaded label data and related forms, you can follow the WeChat public account [45度科研人] and leave me a message!