JunchuanYu / AI-Translator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AI-Translator

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

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

Model

translation: Helsinki-NLP grammar checker: Gramformer text generator: DistilGPT2

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.

AI-Translator

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)

About


Languages

Language:Python 79.8%Language:Jupyter Notebook 20.2%