Spaces:
Sleeping
Sleeping
nikolajking
commited on
Commit
•
80d795f
1
Parent(s):
72278c8
Upload tool
Browse files- aitool.py +15 -0
- app.py +4 -0
- requirements.txt +1 -0
- tool_config.json +5 -0
aitool.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import Tool
|
2 |
+
|
3 |
+
|
4 |
+
class AITranslationTool(Tool):
|
5 |
+
name = "model_translation"
|
6 |
+
description = (
|
7 |
+
"This is a tool that translates "
|
8 |
+
)
|
9 |
+
|
10 |
+
inputs = ["text"]
|
11 |
+
outputs = ["text"]
|
12 |
+
|
13 |
+
def __call__(self, task: str):
|
14 |
+
model = "facebook/nllb-200-distilled-600M"
|
15 |
+
return model.id
|
app.py
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import launch_gradio_demo
|
2 |
+
from aitool import AITranslationTool
|
3 |
+
|
4 |
+
launch_gradio_demo(AITranslationTool)
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
transformers
|
tool_config.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"description": "This is a tool that translates ",
|
3 |
+
"name": "model_translation",
|
4 |
+
"tool_class": "aitool.AITranslationTool"
|
5 |
+
}
|