yonikremer
commited on
Commit
•
16ec708
1
Parent(s):
60501b8
added print statements
Browse files- hanlde_form_submit.py +4 -0
hanlde_form_submit.py
CHANGED
@@ -88,6 +88,7 @@ def on_form_submit(
|
|
88 |
if not is_supported(model_name):
|
89 |
raise UnsupportedModelNameException(model_name)
|
90 |
st.write(f"Loading model: {model_name}...")
|
|
|
91 |
loading_start_time = time()
|
92 |
pipeline = create_pipeline(
|
93 |
model_name=model_name,
|
@@ -96,7 +97,9 @@ def on_form_submit(
|
|
96 |
loading_end_time = time()
|
97 |
loading_time = loading_end_time - loading_start_time
|
98 |
st.write(f"Finished loading model: {model_name} in {loading_time:,.2f} seconds.")
|
|
|
99 |
st.write("Generating text...")
|
|
|
100 |
generation_start_time = time()
|
101 |
generated_text = generate_text(
|
102 |
pipeline=pipeline,
|
@@ -106,6 +109,7 @@ def on_form_submit(
|
|
106 |
generation_end_time = time()
|
107 |
generation_time = generation_end_time - generation_start_time
|
108 |
st.write(f"Finished generating text in {generation_time:,.2f} seconds.")
|
|
|
109 |
if not isinstance(generated_text, str):
|
110 |
raise RuntimeError(f"The model {model_name} did not generate any text.")
|
111 |
if len(generated_text) == 0:
|
|
|
88 |
if not is_supported(model_name):
|
89 |
raise UnsupportedModelNameException(model_name)
|
90 |
st.write(f"Loading model: {model_name}...")
|
91 |
+
print(f"Loading model: {model_name}...")
|
92 |
loading_start_time = time()
|
93 |
pipeline = create_pipeline(
|
94 |
model_name=model_name,
|
|
|
97 |
loading_end_time = time()
|
98 |
loading_time = loading_end_time - loading_start_time
|
99 |
st.write(f"Finished loading model: {model_name} in {loading_time:,.2f} seconds.")
|
100 |
+
print(f"Finished loading model: {model_name} in {loading_time:,} seconds.")
|
101 |
st.write("Generating text...")
|
102 |
+
print("Generating text...")
|
103 |
generation_start_time = time()
|
104 |
generated_text = generate_text(
|
105 |
pipeline=pipeline,
|
|
|
109 |
generation_end_time = time()
|
110 |
generation_time = generation_end_time - generation_start_time
|
111 |
st.write(f"Finished generating text in {generation_time:,.2f} seconds.")
|
112 |
+
print(f"Finished generating text in {generation_time:,.2f} seconds.")
|
113 |
if not isinstance(generated_text, str):
|
114 |
raise RuntimeError(f"The model {model_name} did not generate any text.")
|
115 |
if len(generated_text) == 0:
|