Jay-Rajput commited on
Commit
9cc7490
·
1 Parent(s): 10ac0d4

fixed prediction file

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -20,12 +20,12 @@ OUTCOMES_JSON = 'match_outcomes.json'
20
  PLAYERS_JSON = 'players.json'
21
  image_path = 'ipl_image.png'
22
 
23
- PREDICTIONS_FOLDER = Path("ipl_predictions")
24
- PREDICTIONS_FOLDER.mkdir(parents=True, exist_ok=True)
25
 
26
  prediction_id = uuid.uuid4().hex
27
  # Save prediction to a local JSON file for CommitScheduler to handle
28
- prediction_file_path = f"{PREDICTIONS_FOLDER}/prediction_{prediction_id}.json"
 
 
29
 
30
  # Initialize CommitScheduler
31
  scheduler = CommitScheduler(
@@ -157,7 +157,7 @@ def submit_prediction(
157
  }
158
 
159
  with scheduler.lock:
160
- with prediction_file_path.open("a") as file:
161
  file.write(json.dumps(prediction_data))
162
  file.write("\n")
163
 
 
20
  PLAYERS_JSON = 'players.json'
21
  image_path = 'ipl_image.png'
22
 
 
 
23
 
24
  prediction_id = uuid.uuid4().hex
25
  # Save prediction to a local JSON file for CommitScheduler to handle
26
+ prediction_file = Path("ipl_predictions/") / f"prediction_{prediction_id}.json"
27
+ PREDICTIONS_FOLDER = prediction_file.parent
28
+ PREDICTIONS_FOLDER.mkdir(parents=True, exist_ok=True)
29
 
30
  # Initialize CommitScheduler
31
  scheduler = CommitScheduler(
 
157
  }
158
 
159
  with scheduler.lock:
160
+ with prediction_file.open("a") as file:
161
  file.write(json.dumps(prediction_data))
162
  file.write("\n")
163