Upload 3 files
Browse files- src/__init__.py +0 -0
- src/st_style.py +42 -0
- src/utils.py +16 -0
src/__init__.py
ADDED
|
File without changes
|
src/st_style.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
button_style = """
|
| 2 |
+
<style>
|
| 3 |
+
div.stButton > button:first-child {
|
| 4 |
+
background-color: rgb(255, 75, 75);
|
| 5 |
+
color: rgb(255, 255, 255);
|
| 6 |
+
}
|
| 7 |
+
div.stButton > button:hover {
|
| 8 |
+
background-color: rgb(255, 75, 75);
|
| 9 |
+
color: rgb(255, 255, 255);
|
| 10 |
+
}
|
| 11 |
+
div.stButton > button:active {
|
| 12 |
+
background-color: rgb(255, 75, 75);
|
| 13 |
+
color: rgb(255, 255, 255);
|
| 14 |
+
}
|
| 15 |
+
div.stButton > button:focus {
|
| 16 |
+
background-color: rgb(255, 75, 75);
|
| 17 |
+
color: rgb(255, 255, 255);
|
| 18 |
+
}
|
| 19 |
+
.css-1cpxqw2:focus:not(:active) {
|
| 20 |
+
background-color: rgb(255, 75, 75);
|
| 21 |
+
border-color: rgb(255, 75, 75);
|
| 22 |
+
color: rgb(255, 255, 255);
|
| 23 |
+
}
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
style = """
|
| 27 |
+
<style>
|
| 28 |
+
#MainMenu {
|
| 29 |
+
visibility: hidden;
|
| 30 |
+
}
|
| 31 |
+
footer {
|
| 32 |
+
visibility: hidden;
|
| 33 |
+
}
|
| 34 |
+
header {
|
| 35 |
+
visibility: hidden;
|
| 36 |
+
}
|
| 37 |
+
</style>
|
| 38 |
+
"""
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def apply_prod_style(st):
|
| 42 |
+
return st.markdown(style, unsafe_allow_html=True)
|
src/utils.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from easytextgen import EasyPrompt
|
| 2 |
+
from translate import Translator
|
| 3 |
+
|
| 4 |
+
trans_to_id = Translator(to_lang="id")
|
| 5 |
+
trans_to_en = Translator(to_lang="en")
|
| 6 |
+
prompt = EasyPrompt.from_file("assets/paraphrase-v1.yml")
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def paraphrase_english(english_text: str) -> str:
|
| 10 |
+
return prompt.get_output(english_text).output_text.strip()
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def paraphrase_indonesian(indonesian_text: str) -> str:
|
| 14 |
+
eng_text = trans_to_en.translate(indonesian_text)
|
| 15 |
+
eng_paraphrased = paraphrase_english(eng_text)
|
| 16 |
+
return trans_to_id.translate(eng_paraphrased)
|