Upload folder using huggingface_hub
Browse files- Dockerfile +1 -1
- app.py +4 -4
Dockerfile
CHANGED
|
@@ -11,6 +11,6 @@ COPY . .
|
|
| 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=
|
| 15 |
|
| 16 |
# NOTE: Disable XSRF protection for easier external access in order to make batch predictions
|
|
|
|
| 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=7860", "--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
|
@@ -68,10 +68,10 @@ input_data = pd.DataFrame([{
|
|
| 68 |
|
| 69 |
# Make prediction when the "Predict" button is clicked
|
| 70 |
if st.button("Predict"):
|
| 71 |
-
response = requests.post("https://
|
| 72 |
if response.status_code == 200:
|
| 73 |
-
prediction = response.json()['Predicted total
|
| 74 |
-
st.success(f"Predicted total
|
| 75 |
else:
|
| 76 |
st.error("Error making prediction.")
|
| 77 |
|
|
@@ -84,7 +84,7 @@ uploaded_file = st.file_uploader("Upload CSV file for batch prediction", type=["
|
|
| 84 |
# Make batch prediction when the "Predict Batch" button is clicked
|
| 85 |
if uploaded_file is not None:
|
| 86 |
if st.button("Predict Batch"):
|
| 87 |
-
response = requests.post("https://
|
| 88 |
if response.status_code == 200:
|
| 89 |
predictions = response.json()
|
| 90 |
st.success("Batch predictions completed!")
|
|
|
|
| 68 |
|
| 69 |
# Make prediction when the "Predict" button is clicked
|
| 70 |
if st.button("Predict"):
|
| 71 |
+
response = requests.post("https://sureshsharma4747--ProductStoreSalesPricePredictionBackend.hf.space/v1/salesrevenue", json=input_data.to_dict(orient='records')[0]) # Send data to Flask API
|
| 72 |
if response.status_code == 200:
|
| 73 |
+
prediction = response.json()['Predicted total sales']
|
| 74 |
+
st.success(f"Predicted total sales: {prediction}")
|
| 75 |
else:
|
| 76 |
st.error("Error making prediction.")
|
| 77 |
|
|
|
|
| 84 |
# Make batch prediction when the "Predict Batch" button is clicked
|
| 85 |
if uploaded_file is not None:
|
| 86 |
if st.button("Predict Batch"):
|
| 87 |
+
response = requests.post("https://sureshsharma4747--ProductStoreSalesPricePredictionBackend.hf.space/v1/salesrevenuebatch", files={"file": uploaded_file}) # Send file to Flask API
|
| 88 |
if response.status_code == 200:
|
| 89 |
predictions = response.json()
|
| 90 |
st.success("Batch predictions completed!")
|