Spaces:
Runtime error
Runtime error
nandovallec
commited on
Commit
·
2d25fd0
1
Parent(s):
69ab5a9
Take out print
Browse files
app.py
CHANGED
@@ -22,8 +22,8 @@ def translate(text):
|
|
22 |
# text = "Hello world"
|
23 |
source = "bg"
|
24 |
target = "en"
|
25 |
-
|
26 |
-
|
27 |
# Construct the URL for the request
|
28 |
url = f"https://translation.googleapis.com/language/translate/v2?key={transl_api_key}&q={text}&source={source}&target={target}"
|
29 |
|
@@ -40,9 +40,9 @@ def translate(text):
|
|
40 |
|
41 |
def route_written(text):
|
42 |
translation = translate(text)
|
43 |
-
print(f"Translated: {translation}")
|
44 |
results = re.search('from (.*)to (.*)', translation)
|
45 |
-
print(results.groups())
|
46 |
origin = results.group(1)
|
47 |
# print(origin)
|
48 |
dest = results.group(2)
|
@@ -52,11 +52,11 @@ def route_written(text):
|
|
52 |
|
53 |
def transcribe(audio, mode):
|
54 |
text = pipe(audio)["text"]
|
55 |
-
|
56 |
translation = translate(text)
|
57 |
-
|
58 |
results = re.search('from (.*)to (.*)', translation)
|
59 |
-
|
60 |
origin = results.group(1)
|
61 |
# print(origin)
|
62 |
dest = results.group(2)
|
|
|
22 |
# text = "Hello world"
|
23 |
source = "bg"
|
24 |
target = "en"
|
25 |
+
# print(gmaps_api_key)
|
26 |
+
# print(transl_api_key)
|
27 |
# Construct the URL for the request
|
28 |
url = f"https://translation.googleapis.com/language/translate/v2?key={transl_api_key}&q={text}&source={source}&target={target}"
|
29 |
|
|
|
40 |
|
41 |
def route_written(text):
|
42 |
translation = translate(text)
|
43 |
+
# print(f"Translated: {translation}")
|
44 |
results = re.search('from (.*)to (.*)', translation)
|
45 |
+
# print(results.groups())
|
46 |
origin = results.group(1)
|
47 |
# print(origin)
|
48 |
dest = results.group(2)
|
|
|
52 |
|
53 |
def transcribe(audio, mode):
|
54 |
text = pipe(audio)["text"]
|
55 |
+
# print(f"Original text: {text}")
|
56 |
translation = translate(text)
|
57 |
+
# print(f"Translated: {translation}")
|
58 |
results = re.search('from (.*)to (.*)', translation)
|
59 |
+
# print(results.groups())
|
60 |
origin = results.group(1)
|
61 |
# print(origin)
|
62 |
dest = results.group(2)
|