webtrans

WebTrans 2023 project

webtrans

WebTrans 2023 project

WebTrans is a webservice for transcompiling between programming languages.

IN DEVELOPMENT! NOT FOR PRODUCTION!

Usage

Quick Start

For now, you need an nvidea gpu.

git clone https://github.com/WyvernIXTL/webtrans.git
cd webtrans/src
docker compose build
docker compose up

Should result in the website running on 127.0.0.1:8085

Configure

Before deployment you should configure some env variables in the docker compose file:

  • SECRET_KEY_BASE
  • APP_DOMAIN

The API

Create Token with Login

curl example.com/api/sign_ins -X POST -d "user:email=user@example.com" -d "user:password=changeme"

returns

{"token":"your-token"}

Create Token through Signup

curl example.com/api/sign_ups -X POST -d "user:email=user@example.com" -d "user:password=changeme" -d "user:password_confirmation=changeme"

returns

{"token":"your-token"}

Create Transcompilation Task

curl example.com/api/createtask -X POST -H "Content-Type: application/json" -d '{
	"auth_token": "your-token",
	"transcompile_task": {
		"inp_lang": "inp-lang",
		"outp_lang": "outp-lang",
		"input_code": "your-encoded-code"
	}
}'

returns

{"id":"task-id"}

Check Transcompilation Task

curl example.com/api/checktask/task-id -X GET -d "auth_token=your-token"

returns on success if finished (200)

{"id": "task-id", "completed": "true", "output_code": "output_code"}

if not finished (200)

{"id": "task-id", "completed": "false"}

Documentation

For handcrafted development documentation head to docs/DOCUMENTATION.

Auto generated and always current webui documentation can be found on https://wyvernixtl.github.io/webtrans/.

MISC

Use the Facebookresearch Transcoder Standalone

git clone https://github.com/WyvernIXTL/webtrans.git
cd ./webtrans/src
docker compose build
docker --it --rm --gpus all src-transcoder
python3 translate.py --src_lang <<cpp|python|java>> --tgt_lang <<cpp|python|java>> --model_path /opt/models/model_<<1|2>>.pth < inputfile

Troubleshooting

  • Make sure to have enough RAM (wsl might crash with just 3GB)

License

The project is under MPL 2.0

Screenshots

homescreen taskcreation taskcompletion

Repository

webtrans

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 0
  • over 1 year ago
  • April 24, 2023
License

Mozilla Public License 2.0

Links
Synced at

Sat, 24 May 2025 12:47:51 GMT

Languages