yulongchen commited on
Commit
68eccea
·
1 Parent(s): 2b88a77

Add system

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -159,13 +159,14 @@ def run_model():
159
 
160
  outputs = run_pipeline(
161
  claim, pledge_date, pledge_author, time_start, timestamp, user_id,
162
- update_fn=update_status, suggestion_meta=suggestion_meta
163
  )
164
 
165
  df = pd.read_excel(outputs["sorted_events"])
166
  json_path = os.path.join(TMP_DIR, f"{timestamp}_{user_id}.json")
167
  df.to_json(json_path, orient="records", indent=2)
168
 
 
169
  events = df.to_dict(orient="records")
170
  log_entry = {
171
  "requested_time": timestamp,
@@ -176,7 +177,8 @@ def run_model():
176
  "time_end": time_end,
177
  "pledge_author": pledge_author,
178
  "pledge_date": pledge_date,
179
- "events": events
 
180
  }
181
  default_log_path = f"{FEEDBACK_DIR}/feedback_{timestamp}_{user_id}.jsonl"
182
 
@@ -263,6 +265,7 @@ def receive_feedback():
263
  time_end = previous_log.get("time_end")
264
  pledge_author = previous_log.get("time_start")
265
  pledge_date = previous_log.get("time_end")
 
266
  except Exception:
267
  pass
268
 
@@ -279,7 +282,8 @@ def receive_feedback():
279
  "time_end": time_end,
280
  "pledge_author": pledge_author,
281
  "pledge_date": pledge_date,
282
- "events": events
 
283
  }
284
 
285
  local_filename = f"{FEEDBACK_DIR}/feedback_{timestamp}_{user_id}.jsonl"
 
159
 
160
  outputs = run_pipeline(
161
  claim, pledge_date, pledge_author, time_start, timestamp, user_id,
162
+ update_fn=upda te_status, suggestion_meta=suggestion_meta
163
  )
164
 
165
  df = pd.read_excel(outputs["sorted_events"])
166
  json_path = os.path.join(TMP_DIR, f"{timestamp}_{user_id}.json")
167
  df.to_json(json_path, orient="records", indent=2)
168
 
169
+ now = datetime.now()
170
  events = df.to_dict(orient="records")
171
  log_entry = {
172
  "requested_time": timestamp,
 
177
  "time_end": time_end,
178
  "pledge_author": pledge_author,
179
  "pledge_date": pledge_date,
180
+ "events": events,
181
+ "finish_time": now
182
  }
183
  default_log_path = f"{FEEDBACK_DIR}/feedback_{timestamp}_{user_id}.jsonl"
184
 
 
265
  time_end = previous_log.get("time_end")
266
  pledge_author = previous_log.get("time_start")
267
  pledge_date = previous_log.get("time_end")
268
+ finish_time = previous_log.get("finish_time")
269
  except Exception:
270
  pass
271
 
 
282
  "time_end": time_end,
283
  "pledge_author": pledge_author,
284
  "pledge_date": pledge_date,
285
+ "events": events,
286
+ "finish_time": finish_time
287
  }
288
 
289
  local_filename = f"{FEEDBACK_DIR}/feedback_{timestamp}_{user_id}.jsonl"