Spaces:
Runtime error
Runtime error
datnth1709
commited on
Commit
•
607348e
1
Parent(s):
3f10b33
init commit
Browse files- .gitignore +10 -0
- app.py +15 -0
- requirements.txt +3 -0
.gitignore
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Ignore everything in this directory
|
2 |
+
__pycache__
|
3 |
+
.idea
|
4 |
+
.git
|
5 |
+
.vs
|
6 |
+
.vscode
|
7 |
+
.ipynb_checkpoints
|
8 |
+
|
9 |
+
# Except this file
|
10 |
+
*.pbf
|
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
model_checkpoint = "huynguyen208/fantastic4-finetuned-vi-to-en-PhoMT-demo"
|
5 |
+
translator = pipeline("translation", model=model_checkpoint)
|
6 |
+
|
7 |
+
def translate(Vietnamese):
|
8 |
+
return translator(Vietnamese)[0]['translation_text']
|
9 |
+
|
10 |
+
iface = gr.Interface(fn=translate,
|
11 |
+
inputs=["text"],
|
12 |
+
outputs="text",
|
13 |
+
title = 'Translate Vietnamese to English',
|
14 |
+
description = 'Mini Translator')
|
15 |
+
iface.launch(inline = False)
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
torch
|
2 |
+
gradio
|
3 |
+
transformers[sentencepiece]
|