Platma commited on
Commit
34a0b0f
·
verified ·
1 Parent(s): 1a11765

Update src/main.py

Browse files
Files changed (1) hide show
  1. src/main.py +5 -3
src/main.py CHANGED
@@ -52,16 +52,17 @@ async def post_webhook(
52
 
53
  def schedule_retrain(payload: WebhookPayload):
54
  # Create the autotrain project
 
55
  try:
56
  yaml_path = os.path.join(os.getcwd(), "src/config.yaml")
57
  with open(yaml_path) as f:
58
  list_doc = yaml.safe_load(f)
59
- list_doc['project_name'] = str(int(datetime.datetime.now().timestamp()))
60
 
61
  with open(yaml_path, "w") as f:
62
  yaml.dump(list_doc, f, default_flow_style=False)
63
 
64
- result = Popen(['autotrain', '--config', yaml_path]) # project = AutoTrain.create_project(payload)
65
  # AutoTrain.add_data(project_id=project["id"])
66
  # AutoTrain.start_processing(project_id=project["id"])
67
  except requests.HTTPError as err:
@@ -70,7 +71,8 @@ def schedule_retrain(payload: WebhookPayload):
70
  print(f" {err.response.json()}")
71
  raise
72
  # Notify in the community tab
73
- notify_success('vicuna')
 
74
  print(result.returncode)
75
  return {"processed": True}
76
 
 
52
 
53
  def schedule_retrain(payload: WebhookPayload):
54
  # Create the autotrain project
55
+ id = str(int(datetime.datetime.now().timestamp()))
56
  try:
57
  yaml_path = os.path.join(os.getcwd(), "src/config.yaml")
58
  with open(yaml_path) as f:
59
  list_doc = yaml.safe_load(f)
60
+ list_doc['project_name'] = id
61
 
62
  with open(yaml_path, "w") as f:
63
  yaml.dump(list_doc, f, default_flow_style=False)
64
 
65
+ # result = Popen(['autotrain', '--config', yaml_path]) # project = AutoTrain.create_project(payload)
66
  # AutoTrain.add_data(project_id=project["id"])
67
  # AutoTrain.start_processing(project_id=project["id"])
68
  except requests.HTTPError as err:
 
71
  print(f" {err.response.json()}")
72
  raise
73
  # Notify in the community tab
74
+ # notify_success(id)
75
+ deploy_model(id='1726082187')
76
  print(result.returncode)
77
  return {"processed": True}
78