Update app.py
Browse files
app.py
CHANGED
|
@@ -19,9 +19,17 @@ def display_next10(dataframe, end):
|
|
| 19 |
end = start + 9
|
| 20 |
df_images = df.loc[start:end]
|
| 21 |
return df_images, end
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
#Gradio Blocks
|
| 24 |
-
with gr.Blocks() as demo:
|
| 25 |
gr.Markdown("<h1><center>Utility Gradio Space for viewing PlaygroundAI Images</center></h1>")
|
| 26 |
gr.Markdown(
|
| 27 |
"""<div align="center">This Tool helps you to analyze and inspect the images and corresponding prompts from <a href = "https://playgroundai.com/">Playground AI</a> Images.<br><a href="https://twitter.com/Suhail">Suhail</a> has recently shared an open dataset of all the liked images and their prompts from PlaygroundAI on <a href="https://github.com/playgroundai/liked_images">Github here</a>. This is an attempt to explore this dataset beautifully using the power and flexibility of Gradio!<br><b>To use the tool:</b>First, click on the 'Initial' button, and then iteratively on the 'Next 10' button.<br><b>Bonus:</b>Click on images to get the original PlaygroundAI image displayed on next tab</div>""")
|
|
@@ -31,7 +39,12 @@ with gr.Blocks() as demo:
|
|
| 31 |
b2 = gr.Button("Next 10 Rows")
|
| 32 |
|
| 33 |
with gr.Row():
|
| 34 |
-
out_dataframe = gr.Dataframe(wrap=True,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
b2.click(fn=display_next10, inputs= [out_dataframe, num_end ], outputs=[out_dataframe, num_end], api_name="next_10_rows")
|
| 37 |
|
|
|
|
| 19 |
end = start + 9
|
| 20 |
df_images = df.loc[start:end]
|
| 21 |
return df_images, end
|
| 22 |
+
|
| 23 |
+
custom_css = """
|
| 24 |
+
#image_dataframe td:first-child img {
|
| 25 |
+
width: 300px !important;
|
| 26 |
+
height: auto !important;
|
| 27 |
+
max-width: none !important;
|
| 28 |
+
}
|
| 29 |
+
"""
|
| 30 |
+
|
| 31 |
#Gradio Blocks
|
| 32 |
+
with gr.Blocks(css=custom_css) as demo:
|
| 33 |
gr.Markdown("<h1><center>Utility Gradio Space for viewing PlaygroundAI Images</center></h1>")
|
| 34 |
gr.Markdown(
|
| 35 |
"""<div align="center">This Tool helps you to analyze and inspect the images and corresponding prompts from <a href = "https://playgroundai.com/">Playground AI</a> Images.<br><a href="https://twitter.com/Suhail">Suhail</a> has recently shared an open dataset of all the liked images and their prompts from PlaygroundAI on <a href="https://github.com/playgroundai/liked_images">Github here</a>. This is an attempt to explore this dataset beautifully using the power and flexibility of Gradio!<br><b>To use the tool:</b>First, click on the 'Initial' button, and then iteratively on the 'Next 10' button.<br><b>Bonus:</b>Click on images to get the original PlaygroundAI image displayed on next tab</div>""")
|
|
|
|
| 39 |
b2 = gr.Button("Next 10 Rows")
|
| 40 |
|
| 41 |
with gr.Row():
|
| 42 |
+
out_dataframe = gr.Dataframe(wrap=True,
|
| 43 |
+
row_count=(10, 'fixed'),
|
| 44 |
+
datatype = ["markdown", "markdown", "str", "str", "str", "str", "str", "str"],
|
| 45 |
+
interactive=False,
|
| 46 |
+
elem_id = 'image_dataframe'
|
| 47 |
+
)
|
| 48 |
|
| 49 |
b2.click(fn=display_next10, inputs= [out_dataframe, num_end ], outputs=[out_dataframe, num_end], api_name="next_10_rows")
|
| 50 |
|