vijayendras commited on
Commit
39c79b8
·
verified ·
1 Parent(s): 5cb684e

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +45 -0
  2. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import streamlit as st
3
+ import requests
4
+
5
+ st.title("ExtraaLearn System")
6
+
7
+ # Input fields for product and store data
8
+ Age = st.number_input("Age", min_value=0, value=25)
9
+ Current_Occupation = st.selectbox("Current Occupation", ["Professional", "Student", "Unemployed"])
10
+ First_Interaction = st.selectbox("First Interaction", ["Website", "Mobile App"])
11
+ Profile_Completed = st.selectbox("Profile Completed", ["High", "Medium", "Low"])
12
+ Website_Visits = st.number_input("Website Visits", min_value=0, value=99)
13
+ Time_Spent_on_Website = st.number_input("Time Spent on Website")
14
+ Page_Views_Per_Visit = st.number_input("Page Views Per Visit", min_value=0.000, value=99.000)
15
+ Last_Activity = st.selectbox("Last Activity", ["Website Activity", "Email Activity", "Phone Activity"])
16
+ Print_Media_Type1 = st.selectbox("Print Media Type1", ["Yes", "No"])
17
+ Print_Media_Type2 = st.selectbox("Print Media Type2", ["Yes", "No"])
18
+ Digital_Media = st.selectbox("Digital Media", ["Yes", "No"])
19
+ Educational_Channels = st.selectbox("Educational Channels", ["Yes", "No"])
20
+ Referral = st.selectbox("Referral", ["Yes", "No"])
21
+
22
+ product_data = {
23
+ "Age": Age,
24
+ "Current_Occupation": Current_Occupation,
25
+ "First_Interaction": First_Interaction,
26
+ "Profile_Completed": Profile_Completed,
27
+ "Website_Visits": Website_Visits,
28
+ "Time_Spent_on_Website": Time_Spent_on_Website,
29
+ "Page_Views_Per_Visit": Page_Views_Per_Visit,
30
+ "Last_Activity": Last_Activity,
31
+ "Print_Media_Type1": Print_Media_Type1,
32
+ "Print_Media_Type2": Print_Media_Type2,
33
+ "Digital_Media": Digital_Media,
34
+ "Educational_Channels": Educational_Channels,
35
+ "Referral": Referral
36
+ }
37
+
38
+ if st.button("Predict", type='primary'):
39
+ response = requests.post("https://vijayendras-ExtraaLearn-API.hf.space/v1/predict", json=product_data) # Replace <user_name> and <space_name>
40
+ if response.status_code == 200:
41
+ result = response.json()
42
+ predicted_sales = result["Sales"]
43
+ st.write(f"Predicted Status: ₹{predicted_sales:.2f}")
44
+ else:
45
+ st.error("Error in API request")
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ requests==2.32.3