siddhesh1981 commited on
Commit
3230e7b
·
verified ·
1 Parent(s): 810220d

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -37,14 +37,29 @@ input_data={'Product_Weight':Product_Weight,
37
  # Logic for prediction of single record.
38
 
39
  if st.button('Predict',type='primary'):
40
- response=requests.post('http://siddhesh1981/FrontEnd.hf.space/v1/data',json=input_data)
41
  if response.status_code==200:
42
  result=response.json()
43
  prediction=result['prediction']
44
  st.success(f'Based on the information provided the forecasted sales for the superkart product_id {Product_Id} is {prediction}')
45
  else:
46
  st.error(response.text)
47
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
 
50
 
 
37
  # Logic for prediction of single record.
38
 
39
  if st.button('Predict',type='primary'):
40
+ response=requests.post('http://siddhesh1981-FrontEnd.hf.space/v1/data',json=input_data)
41
  if response.status_code==200:
42
  result=response.json()
43
  prediction=result['prediction']
44
  st.success(f'Based on the information provided the forecasted sales for the superkart product_id {Product_Id} is {prediction}')
45
  else:
46
  st.error(response.text)
47
+
48
+ # Logic for Prediction of batch records
49
+
50
+ st.subheader("Batch Prediction")
51
+
52
+ file2=st.file_uploader('Upload CSV File',type=['csv'])
53
+ if file2 is not None:
54
+ if st.button("Predict for Batch", type='primary'):
55
+ response=requests.post('http://siddhesh1981-FrontEnd.hf.space/v1/databatch',files={'file':file2})
56
+ if response.status_code==200:
57
+ result=response.json()
58
+ st.header("Batch Prediction Results")
59
+ st.write(result)
60
+ else:
61
+ st.error(response.text)
62
+
63
 
64
 
65