Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +88 -38
src/streamlit_app.py
CHANGED
|
@@ -1,40 +1,90 @@
|
|
| 1 |
-
import altair as alt
|
| 2 |
-
import numpy as np
|
| 3 |
-
import pandas as pd
|
| 4 |
import streamlit as st
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
"""
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
.
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
+
st.set_page_config(
|
| 4 |
+
layout="wide"
|
| 5 |
+
)
|
| 6 |
+
# Minimal Heading
|
| 7 |
+
st.title("My Streamlit Application")
|
| 8 |
+
|
| 9 |
+
# Custom CSS for styling the cards, ensuring equal height and spacing
|
| 10 |
+
st.markdown(
|
| 11 |
+
"""
|
| 12 |
+
<style>
|
| 13 |
+
/* Style for the card container */
|
| 14 |
+
.st-emotion-cache-1r6dm1c { /* This targets the columns container */
|
| 15 |
+
gap: 2rem; /* Adjust this value for the distance between cards */
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
/* General card styling */
|
| 19 |
+
.card {
|
| 20 |
+
border: 1px solid #e6e6e6; /* Light border */
|
| 21 |
+
border-radius: 10px; /* Rounded corners */
|
| 22 |
+
padding: 25px; /* Padding inside the card */
|
| 23 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* Subtle shadow */
|
| 24 |
+
display: flex;
|
| 25 |
+
flex-direction: column;
|
| 26 |
+
justify-content: space-between; /* Distribute content vertically */
|
| 27 |
+
height: 350px; /* Fixed height for equal cards */
|
| 28 |
+
background-color: #ffffff; /* White background */
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/* Ensure text input and button fit well */
|
| 32 |
+
.stTextInput > div > div > input {
|
| 33 |
+
border-radius: 5px;
|
| 34 |
+
padding: 10px;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.stButton > button {
|
| 38 |
+
width: 100%; /* Make button full width */
|
| 39 |
+
border-radius: 5px;
|
| 40 |
+
padding: 10px 0;
|
| 41 |
+
margin-top: 15px; /* Space above the button */
|
| 42 |
+
background-color: #4CAF50; /* Green button */
|
| 43 |
+
color: white;
|
| 44 |
+
font-weight: bold;
|
| 45 |
+
border: none;
|
| 46 |
+
cursor: pointer;
|
| 47 |
+
transition: background-color 0.3s ease;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.stButton > button:hover {
|
| 51 |
+
background-color: #45a049;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/* Adjust subheader margin for better spacing */
|
| 55 |
+
h2 {
|
| 56 |
+
margin-top: 0;
|
| 57 |
+
margin-bottom: 20px;
|
| 58 |
+
color: #333333;
|
| 59 |
+
}
|
| 60 |
+
</style>
|
| 61 |
+
""",
|
| 62 |
+
unsafe_allow_html=True
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
# Create two columns for the cards
|
| 66 |
+
col1, col2 = st.columns(2)
|
| 67 |
+
|
| 68 |
+
# Card 1: Text Input and Button
|
| 69 |
+
with col1:
|
| 70 |
+
st.markdown('<div class="card">', unsafe_allow_html=True)
|
| 71 |
+
st.subheader("Input Section")
|
| 72 |
+
|
| 73 |
+
# Text input
|
| 74 |
+
user_input = st.text_input("Enter your text here:", key="input_text_card1")
|
| 75 |
+
|
| 76 |
+
# Button
|
| 77 |
+
if st.button("Process Text", key="process_button_card1"):
|
| 78 |
+
st.write(f"You entered: **{user_input}**")
|
| 79 |
+
st.success("Text processed successfully!")
|
| 80 |
+
|
| 81 |
+
st.markdown('</div>', unsafe_allow_html=True) # Close card div
|
| 82 |
+
|
| 83 |
+
# Card 2: Placeholder for other content
|
| 84 |
+
with col2:
|
| 85 |
+
st.markdown('<div class="card">', unsafe_allow_html=True)
|
| 86 |
+
st.subheader("Output/Display Section")
|
| 87 |
+
st.write("This card can be used to display results, information, or other widgets.")
|
| 88 |
+
st.write("For example, you could show a chart, an image, or more text here.")
|
| 89 |
+
st.info("This is a placeholder for your content.")
|
| 90 |
+
st.markdown('</div>', unsafe_allow_html=True) # Close card div
|