Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,24 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
def translate(df):
|
6 |
#translate the input_text
|
7 |
|
8 |
for i in range(len(df['English'])):
|
9 |
-
|
|
|
|
|
10 |
|
11 |
return df
|
12 |
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
4 |
+
|
5 |
+
en_nl_tokenizer = AutoTokenizer.from_pretrained("Helsinki-NLP/opus-mt-en-nl")
|
6 |
+
en_nl_model = AutoModelForSeq2SeqLM.from_pretrained("Helsinki-NLP/opus-mt-en-nl")
|
7 |
+
|
8 |
+
#translation_pipeline = pipeline("text-classification", model=finbert_sentiment_prosus, tokenizer=finbert_sentiment_prosus_tokenizer)
|
9 |
+
en_nl_translator = pipeline("translation_en_to_nl", model = en_nl_model, tokenizer=en_nl_tokenizer) #might ignore "translation_en_to_nl"
|
10 |
+
#
|
11 |
+
|
12 |
+
|
13 |
+
#gr.Interface.load("models/Helsinki-NLP/opus-mt-en-nl").launch()
|
14 |
|
15 |
def translate(df):
|
16 |
#translate the input_text
|
17 |
|
18 |
for i in range(len(df['English'])):
|
19 |
+
|
20 |
+
input_string = df.loc[i, 'English']
|
21 |
+
df.loc[i, 'Dutch'] = en_nl_translator(input_string)
|
22 |
|
23 |
return df
|
24 |
|