Spaces:
Sleeping
Sleeping
admin
commited on
Commit
·
0d02a82
1
Parent(s):
a72db6b
fix: count_df
Browse files- src/modules/app.py +8 -4
src/modules/app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import re
|
|
|
2 |
import itertools
|
3 |
import pandas as pd
|
4 |
import gradio as gr
|
@@ -75,9 +76,11 @@ with gr.Blocks() as demo:
|
|
75 |
|
76 |
headers = ['ImageId', 'PosX', 'PosY', 'PosPx', 'PosPy', 'SizeX', 'SizeY', 'SizePx', 'SizePy']
|
77 |
|
78 |
-
@gr.render(inputs=[count_url,
|
79 |
-
def update_df(*items):
|
80 |
-
|
|
|
|
|
81 |
if image_count is not None:
|
82 |
positions = calculate_layout(image_count)
|
83 |
df = pd.DataFrame(positions, columns=headers)
|
@@ -103,7 +106,8 @@ with gr.Blocks() as demo:
|
|
103 |
['demo/demo.jpg'],
|
104 |
['demo/logo.png']
|
105 |
],
|
106 |
-
[{'files': ['demo/demo.md', 'demo/demo2.md']},
|
|
|
107 |
['demo/demo.jpg'],
|
108 |
['demo/img/number-1.png', 'demo/img/number-2.png', 'demo/img/number-3.png', 'demo/img/number-4.png', 'demo/img/number-5.png', ]
|
109 |
]
|
|
|
1 |
import re
|
2 |
+
import math
|
3 |
import itertools
|
4 |
import pandas as pd
|
5 |
import gradio as gr
|
|
|
76 |
|
77 |
headers = ['ImageId', 'PosX', 'PosY', 'PosPx', 'PosPy', 'SizeX', 'SizeY', 'SizePx', 'SizePy']
|
78 |
|
79 |
+
@gr.render(inputs=[count_url, idv_img_input])
|
80 |
+
def update_df(*items): # TODO
|
81 |
+
items = 1 if items is None else items
|
82 |
+
image_count = math.prod(len(item) for item in items if item is not None)
|
83 |
+
|
84 |
if image_count is not None:
|
85 |
positions = calculate_layout(image_count)
|
86 |
df = pd.DataFrame(positions, columns=headers)
|
|
|
106 |
['demo/demo.jpg'],
|
107 |
['demo/logo.png']
|
108 |
],
|
109 |
+
# [{'files': ['demo/demo.md', 'demo/demo2.md']},
|
110 |
+
[{'files': ['demo/demo.md']},
|
111 |
['demo/demo.jpg'],
|
112 |
['demo/img/number-1.png', 'demo/img/number-2.png', 'demo/img/number-3.png', 'demo/img/number-4.png', 'demo/img/number-5.png', ]
|
113 |
]
|