Spaces:
Runtime error
Runtime error
finished app no frills
Browse files
app.py
CHANGED
@@ -124,6 +124,7 @@ def train_and_inference(api_key, ontology_id, model_run_id):
|
|
124 |
|
125 |
|
126 |
BASE_DIR = 'dataset'
|
|
|
127 |
|
128 |
for entry in data_json:
|
129 |
data_split = entry['Data Split']
|
@@ -132,6 +133,7 @@ def train_and_inference(api_key, ontology_id, model_run_id):
|
|
132 |
|
133 |
image_url = f"{entry['Labeled Data']}"
|
134 |
label = entry['Label']['classifications'][0]['answer']['value']
|
|
|
135 |
|
136 |
destination_folder = os.path.join(BASE_DIR, data_split, label)
|
137 |
filename = os.path.basename(image_url)
|
@@ -255,7 +257,7 @@ def train_and_inference(api_key, ontology_id, model_run_id):
|
|
255 |
print(f"InvalidArgumentError: {e}. Skipping this data row.")
|
256 |
continue # Skip to the next datarow if an exception occurs
|
257 |
my_checklist_answer = ClassificationAnswer(
|
258 |
-
name = label,
|
259 |
confidence=confidence)
|
260 |
checklist_prediction = ClassificationAnnotation(
|
261 |
name=ontology.classifications()[0].instructions,
|
|
|
124 |
|
125 |
|
126 |
BASE_DIR = 'dataset'
|
127 |
+
labeldict = {}
|
128 |
|
129 |
for entry in data_json:
|
130 |
data_split = entry['Data Split']
|
|
|
133 |
|
134 |
image_url = f"{entry['Labeled Data']}"
|
135 |
label = entry['Label']['classifications'][0]['answer']['value']
|
136 |
+
labeldict[f'{label.lower()}'] = label
|
137 |
|
138 |
destination_folder = os.path.join(BASE_DIR, data_split, label)
|
139 |
filename = os.path.basename(image_url)
|
|
|
257 |
print(f"InvalidArgumentError: {e}. Skipping this data row.")
|
258 |
continue # Skip to the next datarow if an exception occurs
|
259 |
my_checklist_answer = ClassificationAnswer(
|
260 |
+
name = labeldict[label.lower()],
|
261 |
confidence=confidence)
|
262 |
checklist_prediction = ClassificationAnnotation(
|
263 |
name=ontology.classifications()[0].instructions,
|