Spaces:
Running
Running
import gspread | |
from oauth2client.service_account import ServiceAccountCredentials | |
import streamlit as st | |
import re | |
import json | |
import os | |
# Page Configuration | |
st.set_page_config(page_title="FurOmics", page_icon="🐾", layout="centered") | |
def get_google_keys(): | |
google_secrets = st.secrets["google"] | |
if google_secrets is None: | |
google_secrets = os.getenv("google", None) | |
if isinstance(google_secrets, str): | |
google_secrets = json.loads(google_secrets) | |
if google_secrets is None: | |
raise Exception("google api keys could not be initialized") | |
return google_secrets | |
# Function to add email to Google Sheets | |
def add_email_to_sheet(email): | |
google_secrets = get_google_keys() | |
try: | |
# Set up Google Sheets API client | |
scopes = ["https://spreadsheets.google.com/feeds", "https://www.googleapis.com/auth/drive"] | |
creds = ServiceAccountCredentials.from_json_keyfile_dict(google_secrets, scopes) | |
client = gspread.authorize(creds) | |
# Open the sheet and append the email | |
sheet = client.open("FurOmics Waitlist").sheet1 | |
sheet.append_row([email]) | |
return True | |
except Exception as e: | |
st.error(f"An error occurred: {e}") | |
return False | |
# Header | |
st.title("FurOmics 🐈 🦮🐾") | |
st.subheader("The Omics solution to our furry friends!") | |
st.image("catanddog_300x200.jpg", caption="Healthy pets, happier lives.") | |
# About Section | |
st.header("About") | |
st.write(""" | |
🤖 Deep Learning engine | |
🧬 Genome analysis | |
😻 Furry Friends care | |
""") | |
st.subheader("COMING SOON!") | |
# Waitlist Form | |
st.header("Join Our Waitlist") | |
email = st.text_input("Be first to know when our platform launches! 🚀 Leave an email:") | |
if st.button("Join Waitlist"): | |
if email and re.match(r"^[a-z0-9_-]+@[^@]+\.[a-z]+$", email): | |
success = add_email_to_sheet(email) | |
if success: | |
st.success("Thank you for joining the waitlist!") | |
else: | |
st.error("Please enter a valid email address.") | |
# Footer | |
st.markdown("---") | |
st.write("Follow us on [X](https://x.com/FurOmics) | [email](mailto:info@furomics.com)") | |