freemt
commited on
Commit
·
882d6ad
1
Parent(s):
1365be7
Debug
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ os.environ["TZ"] = "Asia/Shanghai"
|
|
13 |
try:
|
14 |
time.tzset()
|
15 |
except Exception:
|
16 |
-
... # Windows wont do
|
17 |
|
18 |
# Bloom
|
19 |
api_url = "https://api-inference.huggingface.co/models/bigscience/bloom"
|
@@ -63,14 +63,14 @@ def bloom_tr(prompt_, from_lang, to_lang, input_prompt="translate this", seed=2,
|
|
63 |
# return output
|
64 |
except Exception as exc:
|
65 |
logger.error(exc)
|
66 |
-
return
|
67 |
|
68 |
try:
|
69 |
output_tmp = output[0]["generated_text"]
|
70 |
return output_tmp
|
71 |
except Exception as exc:
|
72 |
logger.error(exc)
|
73 |
-
return
|
74 |
|
75 |
solution = output_tmp.split(f"\n{to_lang}:")[0]
|
76 |
|
|
|
13 |
try:
|
14 |
time.tzset()
|
15 |
except Exception:
|
16 |
+
logger.warning("Wont work in Windows...") # Windows wont do
|
17 |
|
18 |
# Bloom
|
19 |
api_url = "https://api-inference.huggingface.co/models/bigscience/bloom"
|
|
|
63 |
# return output
|
64 |
except Exception as exc:
|
65 |
logger.error(exc)
|
66 |
+
return f"Unable to fetch anything: {exc}"
|
67 |
|
68 |
try:
|
69 |
output_tmp = output[0]["generated_text"]
|
70 |
return output_tmp
|
71 |
except Exception as exc:
|
72 |
logger.error(exc)
|
73 |
+
return f"Unable to retrieve result, previous output: {output}"
|
74 |
|
75 |
solution = output_tmp.split(f"\n{to_lang}:")[0]
|
76 |
|