debasishdas1985's picture
Upload folder using huggingface_hub
70b926e verified
import streamlit as st
import requests
st.title("ExtraaLearn Lead Prediction System")
# Input fields for product and store data
age = st.number_input("Age", min_value=10, value=30)
current_occupation = st.selectbox("Occupation", ["Professional", "Unemployed", "Student"])
first_interaction = st.selectbox("First Interaction", ["Website", "Mobile App"])
profile_completed = st.selectbox("Profile Compleness", ["Low - (0-50%)", "Medium - (50-75%)", "High (75-100%)"])
website_visits = st.number_input("Website visited", min_value=0, value=0)
time_spent_on_website = st.number_input("Time Spent On Website(In Second)", min_value=0, value=0)
page_views_per_visit = st.number_input("Page Views Per Visit", min_value=0, value=0)
last_activity = st.selectbox("Last Activity", ["Email Activity", "Phone Activity", "Website Activity"])
print_media_type1 = st.selectbox("Seen Ad in the Newspaper", ["Yes", "No"])
print_media_type2 = st.selectbox("Seen Ad in the Magazine", ["Yes", "No"])
digital_media = st.selectbox("Seen Ad in the Digital Platform", ["Yes", "No"])
educational_channels = st.selectbox("Heard about ExtraaLearn From Educational Channels", ["Yes", "No"])
referral = st.selectbox("Referred", ["Yes", "No"])
payload = {
'age': age,
'current_occupation': current_occupation,
'first_interaction': first_interaction,
'profile_completed':profile_completed,
'website_visits': website_visits,
'time_spent_on_website': time_spent_on_website,
'page_views_per_visit': page_views_per_visit,
'last_activity': last_activity,
'print_media_type1': print_media_type1,
'print_media_type2': print_media_type2,
'digital_media': digital_media,
'educational_channels': educational_channels,
'referral': referral
}
if st.button("Predict", type='primary'):
response = requests.post("https://debasishdas1985-ExtraaLearnBackend.hf.space/v1/predict", json=payload)
if response.status_code == 200:
result = response.json()
predicted_lead = result["Lead"]
st.write(f"Predicted Lead Is : {predicted_lead}")
else:
st.error("Error in API request")