RajendrakumarPachaiappan commited on
Commit
a15093b
·
verified ·
1 Parent(s): ba49b6c

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. Dockerfile +22 -12
  2. app.py +49 -0
  3. extraa_learn_project.pkl +3 -0
  4. requirements.txt +3 -3
Dockerfile CHANGED
@@ -1,20 +1,30 @@
1
- FROM python:3.13.5-slim
2
 
3
  WORKDIR /app
 
 
4
 
5
- RUN apt-get update && apt-get install -y \
6
- build-essential \
7
- curl \
8
- git \
9
- && rm -rf /var/lib/apt/lists/*
10
 
11
- COPY requirements.txt ./
12
- COPY src/ ./src/
13
 
14
- RUN pip3 install -r requirements.txt
 
 
15
 
16
- EXPOSE 8501
17
 
18
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
19
 
20
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
+ ENV PYTHONDONTWRITEBYTECODE=1
5
+ ENV PYTHONUNBUFFERED=1
6
 
7
+ # Install OS deps (optional but good for SSL/timezones)
8
+ RUN apt-get update && apt-get install -y --no-install-recommends \
9
+ ca-certificates curl && \
10
+ rm -rf /var/lib/apt/lists/*
 
11
 
12
+ # Copy app
13
+ COPY . /app
14
 
15
+ # Copy and install Python deps
16
+ # COPY requirements.txt /app/requirements.txt
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
 
 
19
 
 
20
 
21
+ # Hugging Face expects 7860
22
+ EXPOSE 7860
23
+
24
+ # Streamlit default settings suitable for Spaces
25
+ ENV STREAMLIT_SERVER_PORT=7860
26
+ ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
27
+ ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
28
+
29
+ # Run
30
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
app.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import requests
3
+
4
+ # Backend URL (update this with your deployed backend URL)
5
+ BACKEND_URL = "https://rajendrakumarpachaiappan-extraa-learn-backend.hf.space/predict"
6
+
7
+ st.set_page_config(page_title="ExtraaLearn Lead Prediction", layout="centered")
8
+
9
+ st.title("ExtraaLearn - Lead Conversion Prediction")
10
+ st.write("Fill the form below to predict whether a lead is likely to convert.")
11
+
12
+ # Collect user input
13
+ current_occupation = st.selectbox("Current Occupation", ["Student", "Working Professional", "Other"])
14
+ first_interaction = st.selectbox("First Interaction", ["Website", "Mobile App", "Other"])
15
+ profile_completed = st.selectbox("Profile Completed", ["Yes", "No"])
16
+ last_activity = st.selectbox("Last Activity", ["Email Opened", "Page Visited", "Form Submitted", "Other"])
17
+ print_media_type1 = st.radio("Print Media Type 1", ["Yes", "No"])
18
+ print_media_type2 = st.radio("Print Media Type 2", ["Yes", "No"])
19
+ digital_media = st.radio("Digital Media", ["Yes", "No"])
20
+ educational_channels = st.radio("Educational Channels", ["Yes", "No"])
21
+ referral = st.radio("Referral", ["Yes", "No"])
22
+
23
+ # Submit button
24
+ if st.button("Predict Lead Conversion"):
25
+ payload = {
26
+ "current_occupation": current_occupation,
27
+ "first_interaction": first_interaction,
28
+ "profile_completed": profile_completed,
29
+ "last_activity": last_activity,
30
+ "print_media_type1": print_media_type1,
31
+ "print_media_type2": print_media_type2,
32
+ "digital_media": digital_media,
33
+ "educational_channels": educational_channels,
34
+ "referral": referral
35
+ }
36
+
37
+ try:
38
+ response = requests.post(BACKEND_URL, json=payload)
39
+ if response.status_code == 200:
40
+ result = response.json()
41
+ prediction = result.get("prediction")
42
+ if prediction == 1:
43
+ st.success("This lead is **likely to convert!**")
44
+ else:
45
+ st.error("This lead is **not likely to convert.**")
46
+ else:
47
+ st.error(f"Error: {response.text}")
48
+ except Exception as e:
49
+ st.error(f"Request failed: {str(e)}")
extraa_learn_project.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3d73d72aae8deaf826eac03287444ad286e091625841015311eb65714e397a9
3
+ size 3314409
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
- altair
2
- pandas
3
- streamlit
 
1
+
2
+ streamlit
3
+ requests