Update app.py
Browse files
app.py
CHANGED
|
@@ -42,23 +42,29 @@ COLOURS_DICT = color_data['color_mapping']
|
|
| 42 |
ATTRIBUTES_DICT = attributes_data['attribute_mapping']
|
| 43 |
|
| 44 |
|
| 45 |
-
def shot(input, category):
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
"colors":{
|
| 54 |
"main":mainColour,
|
| 55 |
"sub":subColour,
|
| 56 |
-
"score":
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
|
| 64 |
|
|
@@ -435,6 +441,7 @@ iface = gr.Interface(
|
|
| 435 |
inputs=[
|
| 436 |
gr.Textbox(label="Image URLs (starting with http/https) comma seperated "),
|
| 437 |
gr.Textbox(label="Category")
|
|
|
|
| 438 |
],
|
| 439 |
outputs="text" ,
|
| 440 |
examples=[
|
|
|
|
| 42 |
ATTRIBUTES_DICT = attributes_data['attribute_mapping']
|
| 43 |
|
| 44 |
|
| 45 |
+
def shot(input, category, level):
|
| 46 |
+
output_dict = {}
|
| 47 |
+
if level = 'variant':
|
| 48 |
+
subColour,mainColour,score = get_colour(ast.literal_eval(str(input)),category)
|
| 49 |
+
openai_parsed_response = get_openAI_tags(ast.literal_eval(str(input)))
|
| 50 |
+
face_embeddings = get_face_embeddings(ast.literal_eval(str(input)))
|
| 51 |
+
cropped_images = get_cropped_images(ast.literal_eval(str(input)),category)
|
| 52 |
+
output_dict['colors'] = {
|
|
|
|
| 53 |
"main":mainColour,
|
| 54 |
"sub":subColour,
|
| 55 |
+
"score":score
|
| 56 |
+
}
|
| 57 |
+
output_dict['image_mapping'] = openai_parsed_response
|
| 58 |
+
output_dict['face_embeddings'] = face_embeddings
|
| 59 |
+
output_dict['cropped_images'] = cropped_images
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
if level = 'product':
|
| 63 |
+
common_result = get_predicted_attributes(ast.literal_eval(str(input)),category)
|
| 64 |
+
output_dict['attributes'] = common_result
|
| 65 |
+
output_dict['subcategory'] = category
|
| 66 |
+
|
| 67 |
+
return output_dict
|
| 68 |
|
| 69 |
|
| 70 |
|
|
|
|
| 441 |
inputs=[
|
| 442 |
gr.Textbox(label="Image URLs (starting with http/https) comma seperated "),
|
| 443 |
gr.Textbox(label="Category")
|
| 444 |
+
gr.Textbox(label="Level; accepted 'variant' or 'product'")
|
| 445 |
],
|
| 446 |
outputs="text" ,
|
| 447 |
examples=[
|