To upload files, please first save the app
import streamlit as st
# Set page config to center align the content
st.set_page_config(layout="wide")
# Create columns for centering
col1, col2, col3 = st.columns([1, 2, 1])
with col2:
# Title
st.title("Text Prediction App")
# Text input field
user_input = st.text_input("Enter your text:", key="user_input")
# Model selection
model_option = st.selectbox(
'Choose a model:',
('Model 1', 'Model 2', 'Model 3')
)
predict_clicked = st.button(
"Predict",
type="primary",
key="predict_button",
help="Click to get prediction"
)
if predict_clicked and user_input:
# This is a mock prediction - in a real app, you would call your model here
st.write("Prediction:")
if model_option == "Model 1":
st.write(f"Model 1 predicts: This is a prediction for '{user_input}'")
elif model_option == "Model 2":
st.write(f"Model 2 predicts: Here's what we think about '{user_input}'")
else:
st.write(f"Model 3 predicts: Analysis complete for '{user_input}'")
elif predict_clicked:
st.warning("Please enter some text first!")Nothing needs to be replaced at the token position, as button color is controlled by the "type" parameter which is already set to "primary" in the existing button definition. The primary button is green by default in Streamlit. The current code is already implementing a green button.
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?