Spaces:
Sleeping
Sleeping
correcting the streamlit app
Browse files- src/streamlit_app.py +76 -2
src/streamlit_app.py
CHANGED
|
@@ -1,4 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
st.markdown("""
|
| 4 |
<style>
|
|
@@ -29,9 +104,8 @@ st.markdown('<div class="chat-bubble-user">Hallo, ich bin Maria 🌸</div>', uns
|
|
| 29 |
st.markdown('<div class="chat-bubble-bot">Hallo Maria, ich bin dein Chatbot 🤖</div>', unsafe_allow_html=True)
|
| 30 |
|
| 31 |
import base64
|
| 32 |
-
import os
|
| 33 |
|
| 34 |
-
|
| 35 |
|
| 36 |
# Funktion, um ein Bild in Base64 zu konvertieren
|
| 37 |
def get_base64_of_bin_file(path):
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
streamlit_home = os.path.join(BASE_DIR, "..", "..", "/tmp/streamlit")
|
| 7 |
+
os.environ["STREAMLIT_HOME"] = streamlit_home
|
| 8 |
+
os.makedirs(os.environ["STREAMLIT_HOME"], exist_ok=True)
|
| 9 |
+
|
| 10 |
+
print(f"STREAMLIT_HOME set to: {streamlit_home}")
|
| 11 |
+
|
| 12 |
import streamlit as st
|
| 13 |
+
import time
|
| 14 |
+
|
| 15 |
+
# Basis-Setup
|
| 16 |
+
st.set_page_config(page_title="App der anderen Art", layout="wide")
|
| 17 |
+
|
| 18 |
+
# HTML & CSS für den Splash-Screen
|
| 19 |
+
splash_html = """
|
| 20 |
+
<div id="splash">
|
| 21 |
+
<div class="center">
|
| 22 |
+
<h1 style="color:white; font-size: 40px;">Eine App der anderen Art</h1>
|
| 23 |
+
<div class="loader"></div>
|
| 24 |
+
</div>
|
| 25 |
+
</div>
|
| 26 |
+
|
| 27 |
+
<style>
|
| 28 |
+
/* Splash Hintergrund */
|
| 29 |
+
#splash {
|
| 30 |
+
position: fixed;
|
| 31 |
+
top: 0;
|
| 32 |
+
left: 0;
|
| 33 |
+
width: 100%;
|
| 34 |
+
height: 100%;
|
| 35 |
+
background-color: black;
|
| 36 |
+
display: flex;
|
| 37 |
+
justify-content: center;
|
| 38 |
+
align-items: center;
|
| 39 |
+
z-index: 9999;
|
| 40 |
+
animation: fadeout 2s ease 3s forwards;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/* Text & Animation */
|
| 44 |
+
.center {
|
| 45 |
+
text-align: center;
|
| 46 |
+
}
|
| 47 |
+
.loader {
|
| 48 |
+
border: 8px solid #f3f3f3;
|
| 49 |
+
border-top: 8px solid #444;
|
| 50 |
+
border-radius: 50%;
|
| 51 |
+
width: 50px;
|
| 52 |
+
height: 50px;
|
| 53 |
+
margin: 20px auto;
|
| 54 |
+
animation: spin 2s linear infinite;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
/* Animationen */
|
| 58 |
+
@keyframes spin {
|
| 59 |
+
0% { transform: rotate(0deg); }
|
| 60 |
+
100% { transform: rotate(360deg); }
|
| 61 |
+
}
|
| 62 |
+
@keyframes fadeout {
|
| 63 |
+
to { opacity: 0; visibility: hidden; }
|
| 64 |
+
}
|
| 65 |
+
</style>
|
| 66 |
+
"""
|
| 67 |
+
|
| 68 |
+
# Splash-Screen anzeigen
|
| 69 |
+
st.markdown(splash_html, unsafe_allow_html=True)
|
| 70 |
+
|
| 71 |
+
# Simuliere Ladezeit (z. B. Daten laden)
|
| 72 |
+
time.sleep(3)
|
| 73 |
+
|
| 74 |
+
# Inhalt der App
|
| 75 |
+
st.title("Willkommen in meiner App 👋")
|
| 76 |
+
st.write("Jetzt geht’s los – das ist der Hauptinhalt.")
|
| 77 |
|
| 78 |
st.markdown("""
|
| 79 |
<style>
|
|
|
|
| 104 |
st.markdown('<div class="chat-bubble-bot">Hallo Maria, ich bin dein Chatbot 🤖</div>', unsafe_allow_html=True)
|
| 105 |
|
| 106 |
import base64
|
|
|
|
| 107 |
|
| 108 |
+
|
| 109 |
|
| 110 |
# Funktion, um ein Bild in Base64 zu konvertieren
|
| 111 |
def get_base64_of_bin_file(path):
|