Spaces:
Running
Running
Create pages/biolab.py
Browse files- pages/biolab.py +63 -0
pages/biolab.py
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
# --- Page Configuration (Optional but good practice) ---
|
4 |
+
st.set_page_config(
|
5 |
+
page_title="Console & Text Input Demo",
|
6 |
+
page_icon=":computer:",
|
7 |
+
layout="centered",
|
8 |
+
initial_sidebar_state="collapsed"
|
9 |
+
)
|
10 |
+
|
11 |
+
# --- Custom Styling for the Orange Button Accent (Applied via config.toml) ---
|
12 |
+
# Ensure you have a .streamlit/config.toml file in your project root
|
13 |
+
# with the [theme] settings as discussed previously.
|
14 |
+
# Example config.toml:
|
15 |
+
# [theme]
|
16 |
+
# primaryColor="#FF4B4B" # Or any other orange hex code like #FFA500
|
17 |
+
# base="light"
|
18 |
+
# backgroundColor="#FFFFFF"
|
19 |
+
# secondaryBackgroundColor="#F0F2F6"
|
20 |
+
# textColor="#26272F"
|
21 |
+
|
22 |
+
|
23 |
+
st.title("Interactive Console & Input")
|
24 |
+
|
25 |
+
# --- Console-like Container ---
|
26 |
+
st.subheader("Output Console")
|
27 |
+
|
28 |
+
# Create an empty container to hold the console output
|
29 |
+
# This allows us to append messages without rerunning the whole app from scratch
|
30 |
+
console_container = st.container(height=300, border=True) # height makes it large, border gives it a frame
|
31 |
+
|
32 |
+
# Initial message in the console
|
33 |
+
with console_container:
|
34 |
+
st.code(">>> Ready for input...", language="bash") # Use st.code for a console look
|
35 |
+
|
36 |
+
# --- Horizontal Separator ---
|
37 |
+
st.markdown("---")
|
38 |
+
|
39 |
+
# --- Long Text Input ---
|
40 |
+
st.subheader("Your Input Here")
|
41 |
+
user_input = st.text_area(
|
42 |
+
"Enter your long text below:",
|
43 |
+
height=200, # Makes the text area tall
|
44 |
+
placeholder="Type something lengthy here... It could be code, a story, or just a lot of thoughts."
|
45 |
+
)
|
46 |
+
|
47 |
+
# --- Action Button ---
|
48 |
+
# The primaryColor from config.toml will style this button orange
|
49 |
+
if st.button("Process Text", use_container_width=True):
|
50 |
+
if user_input:
|
51 |
+
# Simulate processing and append to the console
|
52 |
+
with console_container:
|
53 |
+
st.markdown(f"**>>> Processing input...**")
|
54 |
+
st.code(f"Input received ({len(user_input)} characters):\n{user_input[:200]}...", language="text") # Show first 200 chars
|
55 |
+
st.success("Task completed!")
|
56 |
+
else:
|
57 |
+
with console_container:
|
58 |
+
st.warning(">>> Please enter some text before processing.")
|
59 |
+
|
60 |
+
# --- Sidebar (Optional) ---
|
61 |
+
st.sidebar.header("About This App")
|
62 |
+
st.sidebar.info("This demo showcases a console-like output area with a large text input and a themed button.")
|
63 |
+
st.sidebar.markdown("Button accent color is set via `.streamlit/config.toml`.")
|