Spaces:
Sleeping
Sleeping
Abdulla Fahem
commited on
Commit
·
a08f428
1
Parent(s):
3e4d2df
Add application file
Browse files
app.py
CHANGED
@@ -435,14 +435,14 @@ def main():
|
|
435 |
""")
|
436 |
|
437 |
# Load or train model
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
|
447 |
# Create two columns for input form
|
448 |
col1, col2 = st.columns([2, 1])
|
|
|
435 |
""")
|
436 |
|
437 |
# Load or train model
|
438 |
+
if 'model' not in st.session_state:
|
439 |
+
with st.spinner("Loading AI model... Please wait..."):
|
440 |
+
model, tokenizer = load_or_train_model()
|
441 |
+
if model is None or tokenizer is None:
|
442 |
+
st.error("Failed to load/train the AI model. Please try again.")
|
443 |
+
return
|
444 |
+
st.session_state.model = model
|
445 |
+
st.session_state.tokenizer = tokenizer
|
446 |
|
447 |
# Create two columns for input form
|
448 |
col1, col2 = st.columns([2, 1])
|