Spaces:
Sleeping
Sleeping
Fernando Knüttel commited on
Commit ·
7813c11
1
Parent(s): e7571d3
Applikation with korrekt loading screen and with bold instruction hints
Browse files- src/streamlit_app.py +64 -8
src/streamlit_app.py
CHANGED
|
@@ -71,10 +71,10 @@ if check_password():
|
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
-
if "
|
| 75 |
-
st.session_state.
|
| 76 |
|
| 77 |
-
if not st.session_state.
|
| 78 |
st.set_page_config(page_title="A different kind of application", layout="wide")
|
| 79 |
|
| 80 |
|
|
@@ -128,11 +128,68 @@ if check_password():
|
|
| 128 |
"""
|
| 129 |
|
| 130 |
st.markdown(splash_html, unsafe_allow_html=True)
|
| 131 |
-
if requests.get(API_URL + "/model_status").json()['status']
|
| 132 |
requests.post(API_URL + "/load_model")
|
| 133 |
-
time.sleep(
|
| 134 |
-
|
| 135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
else:
|
| 137 |
|
| 138 |
st.set_page_config(page_title="A different kind of application", layout="centered")
|
|
@@ -258,7 +315,6 @@ if check_password():
|
|
| 258 |
# some interactive placeholder
|
| 259 |
placeholder.markdown(messages[i % len(messages)])
|
| 260 |
status = requests.get(API_URL + "/model_status").json()['status']
|
| 261 |
-
print(status)
|
| 262 |
if status == "not_initialized":
|
| 263 |
requests.post(API_URL + "/load_model")
|
| 264 |
elif status == "ready":
|
|
|
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
+
if "confirmed" not in st.session_state:
|
| 75 |
+
st.session_state.confirmed = False
|
| 76 |
|
| 77 |
+
if not st.session_state.confirmed:
|
| 78 |
st.set_page_config(page_title="A different kind of application", layout="wide")
|
| 79 |
|
| 80 |
|
|
|
|
| 128 |
"""
|
| 129 |
|
| 130 |
st.markdown(splash_html, unsafe_allow_html=True)
|
| 131 |
+
if not requests.get(API_URL + "/model_status").json()['status'] == "ready":
|
| 132 |
requests.post(API_URL + "/load_model")
|
| 133 |
+
time.sleep(1)
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
st.markdown(
|
| 138 |
+
"""
|
| 139 |
+
<style>
|
| 140 |
+
.overlay {
|
| 141 |
+
position: relative;
|
| 142 |
+
top: 0; left: 0;
|
| 143 |
+
width: 100%; height: 100%;
|
| 144 |
+
display: flex;
|
| 145 |
+
justify-content: center;
|
| 146 |
+
align-items: center;
|
| 147 |
+
backdrop-filter: blur(6px);
|
| 148 |
+
z-index: 9998;
|
| 149 |
+
}
|
| 150 |
+
.overlay-box {
|
| 151 |
+
display: flex;
|
| 152 |
+
flex-direction: column;
|
| 153 |
+
justify-content: space-between;
|
| 154 |
+
max-width: 600px;
|
| 155 |
+
min-height: 300px;
|
| 156 |
+
padding: 30px;
|
| 157 |
+
color: #333;
|
| 158 |
+
background: rgba(255,255,255,0.95);
|
| 159 |
+
border-radius: 20px;
|
| 160 |
+
box-shadow: 0 0 20px rgba(0,0,0,0.3);
|
| 161 |
+
text-align: center;
|
| 162 |
+
}
|
| 163 |
+
[data-testid="stVerticalBlock"] {
|
| 164 |
+
-webkit-box-align: center;
|
| 165 |
+
align-items: center;
|
| 166 |
+
}
|
| 167 |
+
[data-testid="stButton"] {
|
| 168 |
+
margin-top: 20px;
|
| 169 |
+
}
|
| 170 |
+
</style>
|
| 171 |
+
<div class="overlay">
|
| 172 |
+
<div class="overlay-box">
|
| 173 |
+
<h2>Welcome 👋</h2>
|
| 174 |
+
<p>This application works a bit differently.<br>
|
| 175 |
+
While the model is warming up, here’s how you can interact:</p>
|
| 176 |
+
<ul style="text-align:left;">
|
| 177 |
+
<li>Ask questions in the chat</li>
|
| 178 |
+
<li>Review model responses</li>
|
| 179 |
+
<li>Experiment with prompts</li>
|
| 180 |
+
</ul>
|
| 181 |
+
</div>
|
| 182 |
+
</div>
|
| 183 |
+
""",
|
| 184 |
+
unsafe_allow_html=True
|
| 185 |
+
)
|
| 186 |
+
|
| 187 |
+
# Button bleibt jetzt sicher im Container
|
| 188 |
+
if st.button("Got it, let’s start 🚀", key="confirm_btn"):
|
| 189 |
+
st.session_state.confirmed = True
|
| 190 |
+
st.rerun()
|
| 191 |
+
|
| 192 |
+
|
| 193 |
else:
|
| 194 |
|
| 195 |
st.set_page_config(page_title="A different kind of application", layout="centered")
|
|
|
|
| 315 |
# some interactive placeholder
|
| 316 |
placeholder.markdown(messages[i % len(messages)])
|
| 317 |
status = requests.get(API_URL + "/model_status").json()['status']
|
|
|
|
| 318 |
if status == "not_initialized":
|
| 319 |
requests.post(API_URL + "/load_model")
|
| 320 |
elif status == "ready":
|