Spaces:
Sleeping
Sleeping
File size: 2,692 Bytes
bfd33ae 1d78e87 1b15c3a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | import streamlit as st
import os
import subprocess
from streamlit_extras.let_it_rain import rain
from streamlit_extras.add_vertical_space import add_vertical_space
def save_env_config(email, password, query, people_filter, hiring_vals, locations, companies):
config_lines = [
f"LINKEDIN_EMAIL={email}",
f"LINKEDIN_PASSWORD={password}",
f"SEARCH_QUERY={query}",
f"APPLY_PEOPLE_FILTER={'True' if people_filter else 'False'}",
f"ACTIVELY_HIRING_VALUES={hiring_vals}",
f"LOCATIONS={locations}",
f"CURRENT_COMPANIES={companies}"
]
with open("config.env", "w") as f:
f.write("\n".join(config_lines))
st.set_page_config(page_title="LinkedIn Automation Tool", page_icon="π", layout="centered")
st.markdown("""
<style>
.main {
background-color: #f5f5f5;
padding: 2rem;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.stButton>button {
background-color: #0072b1;
color: white;
font-weight: bold;
}
</style>
""", unsafe_allow_html=True)
st.image("https://cdn-icons-png.flaticon.com/512/174/174857.png", width=80)
st.title("π LinkedIn Automation Tool")
st.caption("Automate search and connection on LinkedIn with custom filters")
add_vertical_space(1)
with st.container():
email = st.text_input("π§ LinkedIn Email")
password = st.text_input("π LinkedIn Password", type="password")
search_query = st.text_input("π Search Query", placeholder="e.g. Data Scientist")
people_filter = st.checkbox("π₯ Apply 'People' Filter")
hiring_values = st.text_input("πΌ Actively Hiring Job Titles", placeholder="e.g. Software Engineer, Product Manager")
locations = st.text_input("π Locations", placeholder="e.g. India, United States")
companies = st.text_input("π’ Current Companies", placeholder="e.g. Google, Microsoft")
add_vertical_space(1)
if st.button("π Run LinkedIn Bot"):
if email and password and search_query:
save_env_config(email, password, search_query, people_filter, hiring_values, locations, companies)
st.success("β
Config file saved. Running the bot...")
try:
subprocess.run(["python", "main.py"], check=True)
st.balloons()
rain(emoji="π€", font_size=30, falling_speed=5, animation_length=1.5)
st.success("π Bot execution finished.")
except subprocess.CalledProcessError as e:
st.error(f"β Bot execution failed: {e}")
else:
st.error("β οΈ Please enter all required fields (email, password, search query)") |