aenewton42 commited on
Commit
568825a
·
verified ·
1 Parent(s): af32a46

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. Dockerfile +16 -0
  2. app.py +1 -1
  3. requirements.txt +3 -1
Dockerfile ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a minimal base image with Python 3.9 installed
2
+ FROM python:3.9-slim
3
+
4
+ # Set the working directory inside the container to /app
5
+ WORKDIR /app
6
+
7
+ # Copy all files from the current directory on the host to the container's /app directory
8
+ COPY . .
9
+
10
+ # Install Python dependencies listed in requirements.txt
11
+ RUN pip3 install -r requirements.txt
12
+
13
+ # Define the command to run the Streamlit app on port 8501 and make it accessible externally
14
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]
15
+
16
+ # NOTE: Disable XSRF protection for easier external access in order to make batch predictions
app.py CHANGED
@@ -30,7 +30,7 @@ product_data = {
30
  }
31
 
32
  if st.button("Predict", type='primary'):
33
- response = requests.post("https://aenewton42-SuperKart.hf.space/v1/predict", json=product_data) # Complete the code to enter user name and space name to correctly define the endpoint
34
  if response.status_code == 200:
35
  result = response.json()
36
  predicted_sales = result["Sales"]
 
30
  }
31
 
32
  if st.button("Predict", type='primary'):
33
+ response = requests.post("https://aenewton42-SuperKart.hf.space/v1/predict", json=product_data)
34
  if response.status_code == 200:
35
  result = response.json()
36
  predicted_sales = result["Sales"]
requirements.txt CHANGED
@@ -1 +1,3 @@
1
- requests==2.32.3
 
 
 
1
+ pandas==2.2.2
2
+ requests==2.28.1
3
+ streamlit==1.43.2