transpolymer commited on
Commit
8736226
Β·
verified Β·
1 Parent(s): a715cd6

Update contact.py

Browse files
Files changed (1) hide show
  1. contact.py +96 -52
contact.py CHANGED
@@ -1,55 +1,99 @@
1
  import streamlit as st
2
- import streamlit.components.v1 as components
3
 
4
  def show():
5
- st.title("πŸ“¬ Contact Us")
6
- st.write("Feel free to reach out to us by filling the form below.")
7
-
8
- public_key = st.secrets["emailjs"]["public_key"]
9
- service_id = st.secrets["emailjs"]["service_id"]
10
- template_id = st.secrets["emailjs"]["template_id"]
11
-
12
- with st.form(key="contact_form"):
13
- name = st.text_input("Your Name")
14
- email = st.text_input("Your Email")
15
- message = st.text_area("Your Message")
16
- submit_button = st.form_submit_button("Send")
17
-
18
- if submit_button:
19
- if name and email and message:
20
- st.success("Sending your message...")
21
-
22
- js_code = f"""
23
- var templateParams = {{
24
- name: "{name}",
25
- email: "{email}",
26
- message: `{message}`
27
- }};
28
- emailjs.send("{service_id}", "{template_id}", templateParams, "{public_key}")
29
- .then(function(response) {{
30
- console.log("SUCCESS!", response.status, response.text);
31
- window.parent.postMessage({{"type": "success", "message": "Email sent successfully!"}}, "*");
32
- }}, function(error) {{
33
- console.log("FAILED...", error);
34
- window.parent.postMessage({{"type": "error", "message": "Failed to send email."}}, "*");
35
- }});
36
- """
37
-
38
- components.html(f"""
39
- <html>
40
- <head>
41
- <script src="https://cdn.jsdelivr.net/npm/emailjs-com@2.6.4/dist/email.min.js"></script>
42
- <script>
43
- (function() {{
44
- emailjs.init("{public_key}");
45
- {js_code}
46
- }})();
47
- </script>
48
- </head>
49
- <body></body>
50
- </html>
51
- """, height=0)
52
-
53
-
54
- # Call the function to display the contact form
55
- show()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
 
2
 
3
  def show():
4
+ # Custom styles for dark theme and remove top padding
5
+ st.markdown("""
6
+ <style>
7
+ body {
8
+ background-color: #121212;
9
+ color: #f1f1f1;
10
+ }
11
+ section[data-testid="stSidebar"] + div div[data-testid="stVerticalBlock"] {
12
+ padding-top: 0rem;
13
+ }
14
+ .section-title {
15
+ font-size: 26px;
16
+ font-weight: bold;
17
+ color: #4B8BBE;
18
+ margin-top: 2rem;
19
+ }
20
+ .subsection {
21
+ font-size: 18px;
22
+ margin-top: 1rem;
23
+ }
24
+ .faq, .glossary, .troubleshoot {
25
+ background-color: #333333;
26
+ padding: 1rem;
27
+ border-radius: 10px;
28
+ margin-bottom: 1rem;
29
+ color: #f1f1f1;
30
+ }
31
+ .email-box {
32
+ background-color: #2C3E50;
33
+ padding: 1rem;
34
+ border-radius: 10px;
35
+ color: #f1f1f1;
36
+ }
37
+ .st-expanderHeader {
38
+ color: #4B8BBE;
39
+ }
40
+ .st-expanderContent {
41
+ color: #f1f1f1;
42
+ }
43
+ </style>
44
+ """, unsafe_allow_html=True)
45
+
46
+ # Page title
47
+ st.title("πŸ“˜ Help & Support - TransPolymer")
48
+
49
+ st.markdown("<div class='section-title'>❓ Help Center - TransPolymer</div>", unsafe_allow_html=True)
50
+ st.markdown("Welcome to the **TransPolymer Help Page**. This guide will walk you through how to use the app effectively.")
51
+
52
+ # 1. Getting Started
53
+ st.markdown("<div class='section-title'>πŸš€ Getting Started</div>", unsafe_allow_html=True)
54
+ st.markdown("""
55
+ - **Step 1:** Go to the **Prediction** page.
56
+ - **Step 2:** Enter a valid **SMILES string** or choose a polymer from the dropdown.
57
+ - **Step 3:** Click **Predict** to see the results.
58
+ - The app will return **six polymer properties** based on your input.
59
+ """)
60
+
61
+ # 2. FAQ
62
+ st.markdown("<div class='section-title'>πŸ“Œ Frequently Asked Questions</div>", unsafe_allow_html=True)
63
+ with st.expander("🧬 What is a SMILES format?"):
64
+ st.markdown("SMILES (Simplified Molecular Input Line Entry System) is a line notation for describing molecular structures using short ASCII strings.")
65
+ with st.expander("❌ What if I enter an invalid SMILES string?"):
66
+ st.markdown("The system will show an error if the SMILES string is incorrectly formatted or contains special characters.")
67
+
68
+ # 3. Glossary / Terminology
69
+ st.markdown("<div class='section-title'>πŸ“– Glossary</div>", unsafe_allow_html=True)
70
+ with st.container():
71
+ st.markdown("""
72
+ - **Tensile Strength (MPa):** The maximum stress a material can withstand while being stretched or pulled before breaking.
73
+ - **Ionization Energy (eV):** The energy required to remove an electron from a molecule or atom in its gaseous state. Higher values indicate more stability.
74
+ - **Electron Affinity (eV):** The amount of energy released when an electron is added to a molecule or atom.
75
+ - **logP:** The logarithm of the partition coefficient between octanol and water, indicating the compound's hydrophobicity.
76
+ - **Refractive Index:** A measure of how much light bends (or refracts) when passing through a material.
77
+ - **Molecular Weight (g/mol):** The mass of one mole of a substance’s molecules, calculated as the sum of atomic weights.
78
+ """)
79
+
80
+ # 4. Troubleshooting Tips
81
+ st.markdown("<div class='section-title'>πŸ› οΈ Troubleshooting</div>", unsafe_allow_html=True)
82
+ with st.container():
83
+ st.markdown("""
84
+ - ❌ **Common Mistakes**:
85
+ - Extra spaces in SMILES strings
86
+ - Using unsupported or uncommon formats
87
+ - πŸ”„ **To Refresh**: Press `Ctrl+R` or click the "Rerun" button if something goes wrong.
88
+ """)
89
+
90
+ # 5. Support
91
+ st.markdown("<div class='section-title'>πŸ“¬ Support</div>", unsafe_allow_html=True)
92
+ st.markdown("""
93
+ For further help, reach us at πŸ“§ **transpolymer365@gmail.com**
94
+ Or report issues on [GitHub](https://github.com/your-username/transpolymer/issues)
95
+ """)
96
+
97
+ # Run this file directly for testing
98
+ if __name__ == "__main__":
99
+ show()