color theme change test
Browse files
app.py
CHANGED
@@ -60,7 +60,7 @@ class myTheme(Base):
|
|
60 |
font_mono=font_mono,
|
61 |
)
|
62 |
super().set(
|
63 |
-
body_background_fill="repeating-linear-gradient(135deg, *
|
64 |
body_background_fill_dark="repeating-linear-gradient(135deg, *primary_800, *primary_800 10px, *primary_900 10px, *primary_900 20px)",
|
65 |
button_primary_background_fill="linear-gradient(45deg, *primary_300, *secondary_400)",
|
66 |
button_primary_background_fill_hover="linear-gradient(45deg, *primary_200, *secondary_300)",
|
@@ -104,21 +104,18 @@ def opus_trans(article, target_language):
|
|
104 |
Returns:
|
105 |
string: translated piece of article based off target_language
|
106 |
"""
|
107 |
-
print(target_language)
|
108 |
result_lang = detect_lang(article)
|
109 |
|
110 |
if target_language == "English":
|
111 |
target_lang = "en"
|
112 |
elif target_language == "Chinese":
|
113 |
target_lang = "zh"
|
114 |
-
|
115 |
-
print(target_lang)
|
116 |
if result_lang != target_lang:
|
117 |
task_name = f"translation_{result_lang}_to_{target_lang}"
|
118 |
model_name = f"Helsinki-NLP/opus-mt-{result_lang}-{target_lang}"
|
119 |
translator = pipeline(task_name, model=model_name, tokenizer=model_name)
|
120 |
translated = translator(article)[0]["translation_text"]
|
121 |
-
# print(translated)
|
122 |
else:
|
123 |
translated = "Error: You chose the same language as the article detected language. Please reselect language and try again."
|
124 |
return translated
|
|
|
60 |
font_mono=font_mono,
|
61 |
)
|
62 |
super().set(
|
63 |
+
body_background_fill="repeating-linear-gradient(135deg, *primary_800, *primary_800 10px, *primary_900 10px, *primary_900 20px)",
|
64 |
body_background_fill_dark="repeating-linear-gradient(135deg, *primary_800, *primary_800 10px, *primary_900 10px, *primary_900 20px)",
|
65 |
button_primary_background_fill="linear-gradient(45deg, *primary_300, *secondary_400)",
|
66 |
button_primary_background_fill_hover="linear-gradient(45deg, *primary_200, *secondary_300)",
|
|
|
104 |
Returns:
|
105 |
string: translated piece of article based off target_language
|
106 |
"""
|
|
|
107 |
result_lang = detect_lang(article)
|
108 |
|
109 |
if target_language == "English":
|
110 |
target_lang = "en"
|
111 |
elif target_language == "Chinese":
|
112 |
target_lang = "zh"
|
113 |
+
|
|
|
114 |
if result_lang != target_lang:
|
115 |
task_name = f"translation_{result_lang}_to_{target_lang}"
|
116 |
model_name = f"Helsinki-NLP/opus-mt-{result_lang}-{target_lang}"
|
117 |
translator = pipeline(task_name, model=model_name, tokenizer=model_name)
|
118 |
translated = translator(article)[0]["translation_text"]
|
|
|
119 |
else:
|
120 |
translated = "Error: You chose the same language as the article detected language. Please reselect language and try again."
|
121 |
return translated
|