Spaces:
Running
Running
Update pages/Content2Lead.py
Browse files- pages/Content2Lead.py +40 -16
pages/Content2Lead.py
CHANGED
@@ -1,35 +1,59 @@
|
|
1 |
import streamlit as st
|
2 |
import requests
|
|
|
3 |
import os
|
|
|
|
|
4 |
def main():
|
5 |
st.title("Content2Lead Matcher")
|
6 |
email_options = [
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 | |
18 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
with st.form(key='blog2lead_form'):
|
20 |
-
|
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 |
-
|
|
|
26 |
# Define your data payload to send
|
27 |
data_to_send = {
|
28 |
-
"
|
29 |
-
"email_receiver": email_address
|
30 |
}
|
31 |
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
33 |
# Sending the POST request to FastAPI
|
34 |
response = requests.post(endpoint, json=data_to_send)
|
35 |
|
|
|
1 |
import streamlit as st
|
2 |
import requests
|
3 |
+
from dotenv import load_dotenv
|
4 |
import os
|
5 |
+
load_dotenv()
|
6 |
+
endpoint=os.getenv('blog_lead_endpoint')
|
7 |
def main():
|
8 |
st.title("Content2Lead Matcher")
|
9 |
email_options = [
|
10 |
+
"[email protected]",
|
11 |
+
"[email protected]",
|
12 |
+
"[email protected]",
|
13 |
+
"[email protected]",
|
14 |
+
"[email protected]",
|
15 |
+
"[email protected]",
|
16 |
+
"[email protected]",
|
17 |
+
"[email protected]",
|
18 |
+
"[email protected]",
|
19 |
+
"[email protected]",
|
20 | |
21 |
+
]
|
22 |
+
|
23 |
+
account_stages = [
|
24 |
+
"Pre-Sales",
|
25 |
+
"Pre-Sales (Unresponsive, After Call)",
|
26 |
+
"Pre-Sales (Long-Term/ Cold)",
|
27 |
+
"Sales Opportunity",
|
28 |
+
"Closed Lost (Opportunity)",
|
29 |
+
"Current Client",
|
30 |
+
"Pre-Sales (Short-Term/ Hot)",
|
31 |
+
"Pre-Sales (Mid-Term/ Warm)",
|
32 |
+
"Project Cancelled"
|
33 |
+
]
|
34 |
+
|
35 |
+
# Creating a form
|
36 |
with st.form(key='blog2lead_form'):
|
37 |
+
blog_urls = st.text_area("Enter the Content URLs (one per line)", "")
|
38 |
email_address = st.selectbox("Select your email address", email_options)
|
39 |
+
selected_stages = st.multiselect("Select Account Stages (optional)", account_stages)
|
40 |
submit_button = st.form_submit_button(label='Submit')
|
41 |
|
42 |
if submit_button:
|
43 |
+
urls = blog_urls.strip().split('\n')
|
44 |
+
if urls and email_address:
|
45 |
# Define your data payload to send
|
46 |
data_to_send = {
|
47 |
+
"urls": urls,
|
48 |
+
"email_receiver": email_address,
|
49 |
}
|
50 |
|
51 |
+
# Add the filter to the payload only if selected_stages is not empty
|
52 |
+
if selected_stages:
|
53 |
+
data_to_send["filter"] = {
|
54 |
+
"Account Stage": {"$in": selected_stages}
|
55 |
+
}
|
56 |
+
|
57 |
# Sending the POST request to FastAPI
|
58 |
response = requests.post(endpoint, json=data_to_send)
|
59 |
|