[#2] minor changes to deploy settings
Browse files- main_deploy.py +5 -3
main_deploy.py
CHANGED
|
@@ -10,19 +10,21 @@ from idiomify.models import Idiomifier
|
|
| 10 |
|
| 11 |
|
| 12 |
@st.cache(allow_output_mutation=True)
|
| 13 |
-
def
|
| 14 |
config = fetch_config()['idiomifier']
|
| 15 |
model = fetch_idiomifier(config['ver'])
|
| 16 |
idioms = fetch_idioms(config['idioms_ver'])
|
| 17 |
tokenizer = BartTokenizer.from_pretrained(config['bart'])
|
| 18 |
-
return model, tokenizer, idioms
|
| 19 |
|
| 20 |
|
| 21 |
def main():
|
| 22 |
# fetch a pre-trained model
|
| 23 |
-
model, tokenizer, idioms =
|
| 24 |
pipeline = Pipeline(model, tokenizer)
|
| 25 |
st.title("Idiomify Demo")
|
|
|
|
|
|
|
| 26 |
text = st.text_area("Type sentences here",
|
| 27 |
value="Just remember there will always be a hope even when things look black")
|
| 28 |
with st.sidebar:
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
@st.cache(allow_output_mutation=True)
|
| 13 |
+
def fetch_resources() -> Tuple[dict, Idiomifier, BartTokenizer, List[str]]:
|
| 14 |
config = fetch_config()['idiomifier']
|
| 15 |
model = fetch_idiomifier(config['ver'])
|
| 16 |
idioms = fetch_idioms(config['idioms_ver'])
|
| 17 |
tokenizer = BartTokenizer.from_pretrained(config['bart'])
|
| 18 |
+
return config, model, tokenizer, idioms
|
| 19 |
|
| 20 |
|
| 21 |
def main():
|
| 22 |
# fetch a pre-trained model
|
| 23 |
+
config, model, tokenizer, idioms = fetch_resources()
|
| 24 |
pipeline = Pipeline(model, tokenizer)
|
| 25 |
st.title("Idiomify Demo")
|
| 26 |
+
st.markdown(f"Author: `Eu-Bin KIM`")
|
| 27 |
+
st.markdown(f"Version: `{config['ver']}`")
|
| 28 |
text = st.text_area("Type sentences here",
|
| 29 |
value="Just remember there will always be a hope even when things look black")
|
| 30 |
with st.sidebar:
|