Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
# Function to simulate sending an email
|
| 4 |
+
def send_email(tool, email):
|
| 5 |
+
# Here you can add your email sending logic
|
| 6 |
+
# For now, we'll just print the details to the console
|
| 7 |
+
st.write(f"Tool: {tool}")
|
| 8 |
+
st.write(f"Email: {email}")
|
| 9 |
+
st.success("Your request has been sent successfully!")
|
| 10 |
+
|
| 11 |
+
# Store the tool and email in session state
|
| 12 |
+
st.session_state['tool'] = tool
|
| 13 |
+
st.session_state['email'] = email
|
| 14 |
+
st.session_state['page'] = 'mail'
|
| 15 |
+
|
| 16 |
+
# Function for the tool request form page
|
| 17 |
+
def tool_request_page():
|
| 18 |
+
st.title("Tool Request Form")
|
| 19 |
+
|
| 20 |
+
# Input fields
|
| 21 |
+
tool = st.text_input("Tool Name", placeholder="Enter the tool you need")
|
| 22 |
+
email = st.text_input("Your Email", placeholder="Enter your email address")
|
| 23 |
+
|
| 24 |
+
# Send button
|
| 25 |
+
if st.button("Send"):
|
| 26 |
+
if tool and email:
|
| 27 |
+
send_email(tool, email)
|
| 28 |
+
else:
|
| 29 |
+
st.error("Please fill in both the tool name and your email address.")
|
| 30 |
+
|
| 31 |
+
# Function for the email confirmation page
|
| 32 |
+
def mail_page():
|
| 33 |
+
st.title("Email Sent Successfully")
|
| 34 |
+
st.write("Thank you for your tool request! Your email has been sent.")
|
| 35 |
+
st.write("Here are the details of your request:")
|
| 36 |
+
|
| 37 |
+
# Retrieve the tool and email from session state
|
| 38 |
+
tool = st.session_state.get('tool')
|
| 39 |
+
email = st.session_state.get('email')
|
| 40 |
+
|
| 41 |
+
if tool and email:
|
| 42 |
+
st.write(f"**Tool:** {tool}")
|
| 43 |
+
st.write(f"**Email:** {email}")
|
| 44 |
+
else:
|
| 45 |
+
st.write("No request details found.")
|
| 46 |
+
|
| 47 |
+
# Main function to handle page navigation
|
| 48 |
+
def main():
|
| 49 |
+
if 'page' not in st.session_state:
|
| 50 |
+
st.session_state['page'] = 'tool_request'
|
| 51 |
+
|
| 52 |
+
if st.session_state['page'] == 'tool_request':
|
| 53 |
+
tool_request_page()
|
| 54 |
+
elif st.session_state['page'] == 'mail':
|
| 55 |
+
mail_page()
|
| 56 |
+
|
| 57 |
+
if __name__ == "__main__":
|
| 58 |
+
main()
|