Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,49 +9,15 @@ shoelace_list = ['کشی', 'چسب دار', 'بند دار', 'بدون بند',
|
|
9 |
sex_list = ['بزرگسال', 'بزرگسال زنانه', 'بزرگسال مردانه', 'بچگانه', 'بچگانه دختر', 'بچگانه پسر']
|
10 |
sizes = [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]
|
11 |
|
12 |
-
# shoes_data = pd.read_excel('Book1.xlsx')
|
13 |
-
|
14 |
-
# def show_shoes(sizes, types, colors, shoelaces, genders):
|
15 |
-
# shoes_arr = []
|
16 |
-
# selection = [list(map(int, sizes)), genders, colors, types, shoelaces]
|
17 |
-
# for i in range(len(shoes_data['code'].values)):
|
18 |
-
# Flag = True
|
19 |
-
# shoe_code,shoe_name,shoe_company,shoe_sizes,shoe_colors,shoe_shoelaces,shoe_sexes,shoe_types = shoes_data.iloc[i].values
|
20 |
-
# shoes = [shoe_sizes.split('-'), shoe_sexes.split('-'), shoe_colors.split('-'), shoe_types.split('-'), shoe_shoelaces.split('-')]
|
21 |
-
# for select_details, shoe_details in zip(selection, shoes):
|
22 |
-
# if not select_details:
|
23 |
-
# continue
|
24 |
-
# for shoe_d in shoe_details:
|
25 |
-
# if shoe_d not in select_details:
|
26 |
-
# Flag = False
|
27 |
-
# break
|
28 |
-
|
29 |
-
# if not Flag:
|
30 |
-
# break
|
31 |
-
# if Flag:
|
32 |
-
# shoes_arr.append((f'./Img/{shoe_code}.jpg', f'Name: {shoe_name} ***** Code: {shoe_code} ***** Sizes: {shoe_sizes}'))
|
33 |
-
|
34 |
-
# if len(shoes_arr)==0:
|
35 |
-
# shoes_arr.append(('./Img/Empty.png', 'این کالا موجود نمی باشد'))
|
36 |
-
# return shoes_arr
|
37 |
-
|
38 |
-
|
39 |
shoes_data = pd.read_excel('Book1.xlsx')
|
|
|
40 |
def show_shoes(types, genders, colors, shoelaces, sizes):
|
41 |
-
print('sizes', sizes)
|
42 |
-
print('types', types)
|
43 |
-
print('colors', colors)
|
44 |
-
print('shoelaces', shoelaces)
|
45 |
-
print('genders', genders)
|
46 |
-
|
47 |
shoes_arr = []
|
48 |
selection = [types, genders, colors, shoelaces, sizes]
|
49 |
-
print(selection)
|
50 |
for i in range(len(shoes_data)):
|
51 |
Flag = True
|
52 |
shoe_code,shoe_name,_,shoe_sizes,shoe_colors,shoe_shoelaces,shoe_sexes,shoe_types = shoes_data.iloc[i].values
|
53 |
shoes = [shoe_types.split('-'), shoe_sexes.split('-'), shoe_colors.split('-'), shoe_shoelaces.split('-'), shoe_sizes.split('-')]
|
54 |
-
# shoes = [shoe_sizes.split('-'), shoe_sexes.split('-'), shoe_colors.split('-'), shoe_types.split('-'), shoe_shoelaces.split('-')]
|
55 |
|
56 |
for select_details, shoe_details in zip(selection, shoes):
|
57 |
if not select_details:
|
@@ -64,7 +30,8 @@ def show_shoes(types, genders, colors, shoelaces, sizes):
|
|
64 |
if not Flag:
|
65 |
break
|
66 |
if Flag:
|
67 |
-
shoes_arr.append((f'./Img/{shoe_code}.jpg', f'Name: {shoe_name} ***** Code: {shoe_code} ***** Sizes: {shoe_sizes}'))
|
|
|
68 |
|
69 |
if len(shoes_arr)==0:
|
70 |
shoes_arr.append(('./Img/Empty.png', 'این کالا موجود نمی باشد'))
|
@@ -79,7 +46,7 @@ demo = gr.Interface(
|
|
79 |
gr.CheckboxGroup(shoelace_list, label="shoelaces", info="لطفا نوع بند کفش دلخواه را انتخاب کنید"),
|
80 |
gr.Dropdown(sizes, multiselect=True, label="sizes", info="لطفا اندازه پای خود را انتخاب کنید"),
|
81 |
],
|
82 |
-
outputs=gr.Gallery(label="Selected Shoes", columns=[
|
83 |
)
|
84 |
|
85 |
demo.launch(share=True)
|
|
|
9 |
sex_list = ['بزرگسال', 'بزرگسال زنانه', 'بزرگسال مردانه', 'بچگانه', 'بچگانه دختر', 'بچگانه پسر']
|
10 |
sizes = [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
shoes_data = pd.read_excel('Book1.xlsx')
|
13 |
+
|
14 |
def show_shoes(types, genders, colors, shoelaces, sizes):
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
shoes_arr = []
|
16 |
selection = [types, genders, colors, shoelaces, sizes]
|
|
|
17 |
for i in range(len(shoes_data)):
|
18 |
Flag = True
|
19 |
shoe_code,shoe_name,_,shoe_sizes,shoe_colors,shoe_shoelaces,shoe_sexes,shoe_types = shoes_data.iloc[i].values
|
20 |
shoes = [shoe_types.split('-'), shoe_sexes.split('-'), shoe_colors.split('-'), shoe_shoelaces.split('-'), shoe_sizes.split('-')]
|
|
|
21 |
|
22 |
for select_details, shoe_details in zip(selection, shoes):
|
23 |
if not select_details:
|
|
|
30 |
if not Flag:
|
31 |
break
|
32 |
if Flag:
|
33 |
+
# shoes_arr.append((f'./Img/{shoe_code}.jpg', f'Name: {shoe_name} ***** Code: {shoe_code} ***** Sizes: {shoe_sizes}'))
|
34 |
+
shoes_arr.append((f'./Img/{shoe_code}.jpg', f'Name: {shoe_name}\nCode: {shoe_code}\nSizes: {shoe_sizes}'))
|
35 |
|
36 |
if len(shoes_arr)==0:
|
37 |
shoes_arr.append(('./Img/Empty.png', 'این کالا موجود نمی باشد'))
|
|
|
46 |
gr.CheckboxGroup(shoelace_list, label="shoelaces", info="لطفا نوع بند کفش دلخواه را انتخاب کنید"),
|
47 |
gr.Dropdown(sizes, multiselect=True, label="sizes", info="لطفا اندازه پای خود را انتخاب کنید"),
|
48 |
],
|
49 |
+
outputs=gr.Gallery(label="Selected Shoes", allow_preview=True, preview=True, show_label=True, elem_id="gallery", columns=[3], rows=[1], object_fit="contain", height="auto")
|
50 |
)
|
51 |
|
52 |
demo.launch(share=True)
|