Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ from google.auth.transport.requests import Request
|
|
11 |
|
12 |
def update_text_from_dictionary(text, dictionary_path="./en_hi.dict", initial_lookup=True):
|
13 |
if not dictionary_path:
|
14 |
-
return
|
15 |
|
16 |
with open(dictionary_path) as f:
|
17 |
lines = f.read().splitlines()
|
@@ -35,12 +35,12 @@ def update_text_from_dictionary(text, dictionary_path="./en_hi.dict", initial_lo
|
|
35 |
print(f"Original [{initial_lookup}]: ", text)
|
36 |
print(initial_pass_dict)
|
37 |
new_text = " ".join([initial_pass_dict.get(t, t) for t in text.split()])
|
38 |
-
print(f"New [{initial_lookup}]: ",
|
39 |
else:
|
40 |
print(f"Original [{initial_lookup}]: ", text)
|
41 |
print(final_pass_dict)
|
42 |
new_text = " ".join([final_pass_dict.get(t, t) for t in text.split()])
|
43 |
-
print(f"New [{initial_lookup}]: ",
|
44 |
return new_text
|
45 |
|
46 |
|
@@ -158,7 +158,7 @@ def dubpro_english_transliteration(text, call_gpt):
|
|
158 |
)
|
159 |
response = result.json()
|
160 |
response_content = response['candidates'][0]['content']['parts'][0]['text'].replace("output:", "").strip().replace("'text':", "").replace("{", "").replace("}", "").strip().strip("'").strip('"')
|
161 |
-
response_content = transliterate_first_word(response_content)
|
162 |
return response_content
|
163 |
|
164 |
|
|
|
11 |
|
12 |
def update_text_from_dictionary(text, dictionary_path="./en_hi.dict", initial_lookup=True):
|
13 |
if not dictionary_path:
|
14 |
+
return text
|
15 |
|
16 |
with open(dictionary_path) as f:
|
17 |
lines = f.read().splitlines()
|
|
|
35 |
print(f"Original [{initial_lookup}]: ", text)
|
36 |
print(initial_pass_dict)
|
37 |
new_text = " ".join([initial_pass_dict.get(t, t) for t in text.split()])
|
38 |
+
print(f"New [{initial_lookup}]: ", new_text)
|
39 |
else:
|
40 |
print(f"Original [{initial_lookup}]: ", text)
|
41 |
print(final_pass_dict)
|
42 |
new_text = " ".join([final_pass_dict.get(t, t) for t in text.split()])
|
43 |
+
print(f"New [{initial_lookup}]: ", new_text)
|
44 |
return new_text
|
45 |
|
46 |
|
|
|
158 |
)
|
159 |
response = result.json()
|
160 |
response_content = response['candidates'][0]['content']['parts'][0]['text'].replace("output:", "").strip().replace("'text':", "").replace("{", "").replace("}", "").strip().strip("'").strip('"')
|
161 |
+
# response_content = transliterate_first_word(response_content)
|
162 |
return response_content
|
163 |
|
164 |
|