Spaces:
Sleeping
Sleeping
Upload pages_Blogs.py
Browse files- pages/pages_Blogs.py +61 -0
pages/pages_Blogs.py
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import requests
|
3 |
+
from dotenv import load_dotenv
|
4 |
+
import os
|
5 |
+
load_dotenv()
|
6 |
+
def main():
|
7 |
+
st.title("Blog2Lead Matcher")
|
8 |
+
email_options = [
|
9 |
+
"[email protected]",
|
10 |
+
"[email protected]",
|
11 |
+
"[email protected]",
|
12 |
+
"[email protected]",
|
13 |
+
"[email protected]",
|
14 |
+
"[email protected]",
|
15 |
+
"[email protected]",
|
16 |
+
"[email protected]",
|
17 | |
18 |
+
] # Creating a form
|
19 |
+
with st.form(key='blog2lead_form'):
|
20 |
+
blog_url = st.text_input("Enter the blog URL", "")
|
21 |
+
email_address = st.selectbox("Select your email address", email_options)
|
22 |
+
submit_button = st.form_submit_button(label='Submit')
|
23 |
+
|
24 |
+
if submit_button:
|
25 |
+
if blog_url and email_address:
|
26 |
+
# Define your data payload to send
|
27 |
+
data_to_send = {
|
28 |
+
"url": blog_url,
|
29 |
+
"email_receiver": email_address
|
30 |
+
}
|
31 |
+
|
32 |
+
endpoint = os.getenv("backend")
|
33 |
+
# Sending the POST request to FastAPI
|
34 |
+
response = requests.post(endpoint, json=data_to_send)
|
35 |
+
|
36 |
+
# Handling the response
|
37 |
+
if response.status_code == 200:
|
38 |
+
st.info("Your request has been processed successfully.")
|
39 |
+
else:
|
40 |
+
st.error("Data transmission failed. Please try again later.")
|
41 |
+
else:
|
42 |
+
st.error("Please fill out all fields.")
|
43 |
+
|
44 |
+
if __name__ == "__main__":
|
45 |
+
logo_url = "https://i.imgur.com/WYnv26e.jpeg" # Replace this with your image's direct URL
|
46 |
+
st.markdown(
|
47 |
+
f"""
|
48 |
+
<style>
|
49 |
+
.logo {{
|
50 |
+
position: fixed;
|
51 |
+
bottom: 5px;
|
52 |
+
right: 5px;
|
53 |
+
width: 100px; # Adjust width as needed
|
54 |
+
}}
|
55 |
+
</style>
|
56 |
+
<img src="{logo_url}" class="logo">
|
57 |
+
""",
|
58 |
+
unsafe_allow_html=True,
|
59 |
+
)
|
60 |
+
|
61 |
+
main()
|