Spaces:
Runtime error
Runtime error
update grid layout
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ def process_response(response_dict):
|
|
22 |
|
23 |
response_dict = get_initial_images()
|
24 |
initial = process_response(response_dict)
|
25 |
-
initial_imgs = '<div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); grid-gap: 0; ">\n' + "\n".join(initial[:-1])
|
26 |
|
27 |
#Third: Load more images for the grid
|
28 |
def get_next10_images(response_dict, row_count):
|
@@ -38,10 +38,11 @@ def get_next10_images(response_dict, row_count):
|
|
38 |
#print("(2)",type(response))
|
39 |
#print("(3)",type(response['data'][0]))
|
40 |
next_set = [resp[0][:-1] for resp in response_dict["data"]]
|
41 |
-
next_set_images = '<div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); grid-gap: 0; ">\n' + "\n".join(next_set[:-1])
|
42 |
return response['data'][0], row_count, next_set_images
|
43 |
|
44 |
#get_next10_images(response_dict=response_dict, row_count=9)
|
|
|
45 |
|
46 |
#Defining the Blocks layout
|
47 |
with gr.Blocks(css = """#img_search img {width: 100%; height: 100%; object-fit: cover;}""") as demo:
|
|
|
22 |
|
23 |
response_dict = get_initial_images()
|
24 |
initial = process_response(response_dict)
|
25 |
+
initial_imgs = '<div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); grid-gap: 0; position: fixed; top: 0; left: 0; width: 100%; background-color: #fff; padding: 20px; box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);">\n' + "\n".join(initial[:-1])
|
26 |
|
27 |
#Third: Load more images for the grid
|
28 |
def get_next10_images(response_dict, row_count):
|
|
|
38 |
#print("(2)",type(response))
|
39 |
#print("(3)",type(response['data'][0]))
|
40 |
next_set = [resp[0][:-1] for resp in response_dict["data"]]
|
41 |
+
next_set_images = '<div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); grid-gap: 0; position: fixed; top: 0; left: 0; width: 100%; background-color: #fff; padding: 20px; box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); ">\n' + "\n".join(next_set[:-1])
|
42 |
return response['data'][0], row_count, next_set_images
|
43 |
|
44 |
#get_next10_images(response_dict=response_dict, row_count=9)
|
45 |
+
#position: fixed; top: 0; left: 0; width: 100%; background-color: #fff; padding: 20px; box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
46 |
|
47 |
#Defining the Blocks layout
|
48 |
with gr.Blocks(css = """#img_search img {width: 100%; height: 100%; object-fit: cover;}""") as demo:
|