aamirtaymoor commited on
Commit
58be0e4
·
verified ·
1 Parent(s): 0a00338

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -1
main.py CHANGED
@@ -66,6 +66,7 @@ def predict_file_responses(file: UploadFile = File(...)):
66
  except Exception as e:
67
  raise HTTPException(status_code=400, detail=f"Error processing CSV file: {e}")
68
  processed_data_list = list()
 
69
  for index, row in df.iterrows():
70
  try:
71
  text = row['ACTUAL REVIEW']
@@ -73,10 +74,11 @@ def predict_file_responses(file: UploadFile = File(...)):
73
  review_id = row['REVIEWID']
74
  raw_data = {"text":text, "star_rating":star_rating, "skip":False}
75
  processed_data, has_sentiments = process_single_comment(raw_data)
76
- print(f"Raw data for row {index} : {raw_data}")
77
  processed_data_list.append({"processed_data":processed_data, "has_sentiments":has_sentiments, "review_id":review_id})
78
  finally:
79
  pass
 
 
80
  return processed_data_list
81
 
82
  app.mount("/", StaticFiles(directory="static", html=True), name="static")
 
66
  except Exception as e:
67
  raise HTTPException(status_code=400, detail=f"Error processing CSV file: {e}")
68
  processed_data_list = list()
69
+ start_time = time.time()
70
  for index, row in df.iterrows():
71
  try:
72
  text = row['ACTUAL REVIEW']
 
74
  review_id = row['REVIEWID']
75
  raw_data = {"text":text, "star_rating":star_rating, "skip":False}
76
  processed_data, has_sentiments = process_single_comment(raw_data)
 
77
  processed_data_list.append({"processed_data":processed_data, "has_sentiments":has_sentiments, "review_id":review_id})
78
  finally:
79
  pass
80
+ end_time = time.time()
81
+ print(f">>>>>>>>>>>>>>>>>>>>>>>> Processing time : {end_time - start_time} seconds >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
82
  return processed_data_list
83
 
84
  app.mount("/", StaticFiles(directory="static", html=True), name="static")