Spaces:
No application file
No application file
| import streamlit as st | |
| import requests | |
| st.title("ExtraaLearn System") | |
| # Input fields for product and store data | |
| Age = st.number_input("Age", min_value=0, value=25) | |
| Current_Occupation = st.selectbox("Current Occupation", ["Professional", "Student", "Unemployed"]) | |
| First_Interaction = st.selectbox("First Interaction", ["Website", "Mobile App"]) | |
| Profile_Completed = st.selectbox("Profile Completed", ["High", "Medium", "Low"]) | |
| Website_Visits = st.number_input("Website Visits", min_value=0, value=99) | |
| Time_Spent_on_Website = st.number_input("Time Spent on Website") | |
| Page_Views_Per_Visit = st.number_input("Page Views Per Visit", min_value=0.000, value=99.000) | |
| Last_Activity = st.selectbox("Last Activity", ["Website Activity", "Email Activity", "Phone Activity"]) | |
| Print_Media_Type1 = st.selectbox("Print Media Type1", ["Yes", "No"]) | |
| Print_Media_Type2 = st.selectbox("Print Media Type2", ["Yes", "No"]) | |
| Digital_Media = st.selectbox("Digital Media", ["Yes", "No"]) | |
| Educational_Channels = st.selectbox("Educational Channels", ["Yes", "No"]) | |
| Referral = st.selectbox("Referral", ["Yes", "No"]) | |
| product_data = { | |
| "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://vijayendras-ExtraaLearn-API.hf.space/v1/predict", json=product_data) # Replace <user_name> and <space_name> | |
| if response.status_code == 200: | |
| result = response.json() | |
| predicted_sales = result["Sales"] | |
| st.write(f"Predicted Status: ₹{predicted_sales:.2f}") | |
| else: | |
| st.error("Error in API request") | |