Spaces:
Runtime error
Runtime error
nobrowning
commited on
Commit
•
7e1e718
1
Parent(s):
7936150
add language detection
Browse files
app.py
CHANGED
@@ -177,10 +177,11 @@ if st.button("Run"):
|
|
177 |
lang_type = LANGUANGE_MAP[preds.item()]
|
178 |
|
179 |
if lang_type not in lang_id:
|
|
|
180 |
st.success('Unsupported Language')
|
181 |
st.write(f"Computation time: {round((time_end-time_start),3)} segs")
|
182 |
else:
|
183 |
-
src_lang = lang_id[]
|
184 |
trg_lang = lang_id[target_lang]
|
185 |
tokenizer.src_lang = src_lang
|
186 |
encoded_input = tokenizer(user_input, return_tensors="pt").to(device)
|
|
|
177 |
lang_type = LANGUANGE_MAP[preds.item()]
|
178 |
|
179 |
if lang_type not in lang_id:
|
180 |
+
time_end = time.time()
|
181 |
st.success('Unsupported Language')
|
182 |
st.write(f"Computation time: {round((time_end-time_start),3)} segs")
|
183 |
else:
|
184 |
+
src_lang = lang_id[lang_type]
|
185 |
trg_lang = lang_id[target_lang]
|
186 |
tokenizer.src_lang = src_lang
|
187 |
encoded_input = tokenizer(user_input, return_tensors="pt").to(device)
|