wuhp commited on
Commit
0f6f202
·
verified ·
1 Parent(s): 66be7dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -165,7 +165,6 @@ def upload_and_train_detection(
165
  Returns the hosted endpoint URL.
166
  """
167
  rf = Roboflow(api_key=api_key)
168
- # use your active workspace (no name needed)
169
  ws = rf.workspace()
170
 
171
  # 1) get-or-create
@@ -182,10 +181,11 @@ def upload_and_train_detection(
182
  else:
183
  raise
184
 
185
- # 2) upload everything under dataset_path
 
186
  ws.upload_dataset(
187
  dataset_path,
188
- proj.slug,
189
  project_license=project_license,
190
  project_type=project_type
191
  )
@@ -200,7 +200,7 @@ def upload_and_train_detection(
200
  msg = str(e).lower()
201
  if "unsupported request" in msg or "does not exist" in msg:
202
  # bump slug and retry
203
- new_slug = proj.slug + "-v2"
204
  proj = ws.create_project(
205
  new_slug,
206
  annotation=project_type,
@@ -209,7 +209,7 @@ def upload_and_train_detection(
209
  )
210
  ws.upload_dataset(
211
  dataset_path,
212
- proj.slug,
213
  project_license=project_license,
214
  project_type=project_type
215
  )
 
165
  Returns the hosted endpoint URL.
166
  """
167
  rf = Roboflow(api_key=api_key)
 
168
  ws = rf.workspace()
169
 
170
  # 1) get-or-create
 
181
  else:
182
  raise
183
 
184
+ # 2) extract real slug from proj.id and upload
185
+ _, real_slug = proj.id.rsplit("/", 1)
186
  ws.upload_dataset(
187
  dataset_path,
188
+ real_slug,
189
  project_license=project_license,
190
  project_type=project_type
191
  )
 
200
  msg = str(e).lower()
201
  if "unsupported request" in msg or "does not exist" in msg:
202
  # bump slug and retry
203
+ new_slug = real_slug + "-v2"
204
  proj = ws.create_project(
205
  new_slug,
206
  annotation=project_type,
 
209
  )
210
  ws.upload_dataset(
211
  dataset_path,
212
+ new_slug,
213
  project_license=project_license,
214
  project_type=project_type
215
  )