Spaces:
Sleeping
Sleeping
clean up
Browse files
app.py
CHANGED
@@ -19,12 +19,13 @@ def get_tokenizer(model_name):
|
|
19 |
|
20 |
@st.experimental_singleton
|
21 |
def get_model(model_name):
|
22 |
-
|
|
|
|
|
23 |
|
24 |
tokenizer = get_tokenizer(model_name)
|
25 |
model = get_model(model_name)
|
26 |
|
27 |
-
print(f"The model has {model.num_parameters():,d} parameters.")
|
28 |
|
29 |
input_text = st.text_input("Enter text to translate", "Hola, mi nombre es Juan")
|
30 |
input_text = input_text.strip()
|
@@ -67,4 +68,3 @@ with tokenizer.as_target_tokenizer():
|
|
67 |
|
68 |
|
69 |
st.write(probs_table)
|
70 |
-
st.write(model.config.decoder_start_token_id)
|
|
|
19 |
|
20 |
@st.experimental_singleton
|
21 |
def get_model(model_name):
|
22 |
+
model = MarianMTModel.from_pretrained(model_name).to(device)
|
23 |
+
print(f"Loaded model, {model.num_parameters():,d} parameters.")
|
24 |
+
return model
|
25 |
|
26 |
tokenizer = get_tokenizer(model_name)
|
27 |
model = get_model(model_name)
|
28 |
|
|
|
29 |
|
30 |
input_text = st.text_input("Enter text to translate", "Hola, mi nombre es Juan")
|
31 |
input_text = input_text.strip()
|
|
|
68 |
|
69 |
|
70 |
st.write(probs_table)
|
|