Spaces:
Runtime error
Runtime error
inclusive-ml
commited on
Commit
•
1734a82
1
Parent(s):
97c311c
translate, summarize, similarity
Browse files
app.py
CHANGED
@@ -6,7 +6,6 @@ import tensorflow_text
|
|
6 |
import tensorflow as tf
|
7 |
def main():
|
8 |
st.title("Interactive demo: T5 Multitasking Demo")
|
9 |
-
st.sidebar.image("https://i.gzn.jp/img/2020/02/25/google-ai-t5/01.png")
|
10 |
saved_model_path = load_model_cache()
|
11 |
# Model is loaded in st.session_state to remain stateless across reloading
|
12 |
if 'model' not in st.session_state:
|
@@ -20,7 +19,7 @@ def load_model_cache():
|
|
20 |
if not os.path.exists(CACHE_DIR):
|
21 |
os.mkdir(CACHE_DIR)
|
22 |
# download the files from huggingface repo and load the model with tensorflow
|
23 |
-
snapshot_download(repo_id="
|
24 |
saved_model_path = os.path.join(CACHE_DIR, os.listdir(CACHE_DIR)[0])
|
25 |
return saved_model_path
|
26 |
def dashboard(model):
|
@@ -31,9 +30,6 @@ def dashboard(model):
|
|
31 |
task_type = st.sidebar.radio("Task Type",
|
32 |
[
|
33 |
"Translate English to French",
|
34 |
-
"Translate English to German",
|
35 |
-
"Translate English to Romanian",
|
36 |
-
"Grammatical Correctness of Sentence",
|
37 |
"Text Summarization",
|
38 |
"Document Similarity Score"
|
39 |
])
|
@@ -107,9 +103,6 @@ def predict(task_type, sentence, model):
|
|
107 |
"""
|
108 |
task_dict = {
|
109 |
"Translate English to French": "Translate English to French",
|
110 |
-
"Translate English to German": "Translate English to German",
|
111 |
-
"Translate English to Romanian": "Translate English to Romanian",
|
112 |
-
"Grammatical Correctness of Sentence": "cola sentence",
|
113 |
"Text Summarization": "summarize",
|
114 |
"Document Similarity Score": "stsb",
|
115 |
}
|
|
|
6 |
import tensorflow as tf
|
7 |
def main():
|
8 |
st.title("Interactive demo: T5 Multitasking Demo")
|
|
|
9 |
saved_model_path = load_model_cache()
|
10 |
# Model is loaded in st.session_state to remain stateless across reloading
|
11 |
if 'model' not in st.session_state:
|
|
|
19 |
if not os.path.exists(CACHE_DIR):
|
20 |
os.mkdir(CACHE_DIR)
|
21 |
# download the files from huggingface repo and load the model with tensorflow
|
22 |
+
snapshot_download(repo_id="widged/translate-to-french", cache_dir=CACHE_DIR)
|
23 |
saved_model_path = os.path.join(CACHE_DIR, os.listdir(CACHE_DIR)[0])
|
24 |
return saved_model_path
|
25 |
def dashboard(model):
|
|
|
30 |
task_type = st.sidebar.radio("Task Type",
|
31 |
[
|
32 |
"Translate English to French",
|
|
|
|
|
|
|
33 |
"Text Summarization",
|
34 |
"Document Similarity Score"
|
35 |
])
|
|
|
103 |
"""
|
104 |
task_dict = {
|
105 |
"Translate English to French": "Translate English to French",
|
|
|
|
|
|
|
106 |
"Text Summarization": "summarize",
|
107 |
"Document Similarity Score": "stsb",
|
108 |
}
|