File size: 2,123 Bytes
70ffb34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0e3e6c2
70ffb34
 
 
70b926e
70ffb34
 
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

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")