Spaces:
Sleeping
Sleeping
import streamlit as st | |
import requests | |
import os | |
def main(): | |
st.title("Content2Lead Matcher") | |
email_options = [ | |
"[email protected]", | |
"[email protected]", | |
"[email protected]", | |
"[email protected]", | |
"[email protected]", | |
"[email protected]", | |
"[email protected]", | |
"[email protected]", | |
"[email protected]", | |
"[email protected]" , | |
"[email protected]" | |
] # Creating a form | |
with st.form(key='blog2lead_form'): | |
blog_url = st.text_input("Enter the Content URL", "") | |
email_address = st.selectbox("Select your email address", email_options) | |
submit_button = st.form_submit_button(label='Submit') | |
if submit_button: | |
if blog_url and email_address: | |
# Define your data payload to send | |
data_to_send = { | |
"url": blog_url, | |
"email_receiver": email_address | |
} | |
endpoint = os.getenv("blog_lead_endpoint") | |
# Sending the POST request to FastAPI | |
response = requests.post(endpoint, json=data_to_send) | |
# Handling the response | |
if response.status_code == 200: | |
st.info("Your request has been processed successfully.") | |
else: | |
st.error("Data transmission failed. Please try again later.") | |
else: | |
st.error("Please fill out all fields.") | |
if __name__ == "__main__": | |
logo_url = "https://i.imgur.com/WYnv26e.jpeg" # Replace this with your image's direct URL | |
st.markdown( | |
f""" | |
<style> | |
.logo {{ | |
position: fixed; | |
bottom: 5px; | |
right: 5px; | |
width: 100px; # Adjust width as needed | |
}} | |
</style> | |
<img src="{logo_url}" class="logo"> | |
""", | |
unsafe_allow_html=True, | |
) | |
main() | |