Replicate the app from the image.
To upload files, please first save the app
import streamlit as st
# Title of the app
st.title('Talk2Data for Streamlit')
# Sidebar with file upload and options
st.sidebar.header('Sidebar')
file = st.sidebar.file_uploader('File Upload', type=['csv', 'txt'])
drag_drop = st.sidebar.file_uploader('Drag & Drop')
if st.sidebar.button('Clear Cache'):
st.cache_data.clear()
# Show error message if no file is uploaded
if not file:
st.sidebar.warning('Error msg if a file is not uploaded')
# Chat history
st.subheader('Show Chat History')
if 'history' not in st.session_state:
st.session_state.history = []
for message in st.session_state.history:
st.markdown(message)
# User input prompt
user_prompt = st.text_input('User prompt')
if st.button('Submit'):
st.session_state.history.append(f'User: {user_prompt}')
# Here you would add the logic to generate the system response
# For now, we will just echo the user message
st.session_state.history.append(f'System: Echoed back: {user_prompt}')
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?