Spaces:
Runtime error
Runtime error
SUPERFIRE777
commited on
Commit
·
3419893
1
Parent(s):
c073165
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,10 @@
|
|
1 |
import gradio as gr
|
2 |
-
from
|
3 |
from textblob import TextBlob
|
4 |
|
5 |
def analyze(sentence):
|
6 |
-
# Create a Translator object
|
7 |
-
translator = Translator()
|
8 |
-
|
9 |
# Translate the sentence from Japanese to English
|
10 |
-
|
11 |
-
|
12 |
-
# The translated sentence
|
13 |
-
en_sentence = translation.text
|
14 |
|
15 |
# Create a TextBlob object for the sentence
|
16 |
blob = TextBlob(en_sentence)
|
@@ -28,4 +22,4 @@ def analyze(sentence):
|
|
28 |
|
29 |
|
30 |
iface = gr.Interface(fn=analyze, inputs="text", outputs="text")
|
31 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from mtranslate import translate
|
3 |
from textblob import TextBlob
|
4 |
|
5 |
def analyze(sentence):
|
|
|
|
|
|
|
6 |
# Translate the sentence from Japanese to English
|
7 |
+
en_sentence = translate(sentence, "en")
|
|
|
|
|
|
|
8 |
|
9 |
# Create a TextBlob object for the sentence
|
10 |
blob = TextBlob(en_sentence)
|
|
|
22 |
|
23 |
|
24 |
iface = gr.Interface(fn=analyze, inputs="text", outputs="text")
|
25 |
+
iface.launch()
|