ysharma HF staff commited on
Commit
dbff739
·
verified ·
1 Parent(s): b18dc33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -23,21 +23,18 @@ def display_next10(dataframe, end):
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("""<img src='https://xxxxxxxx.jpg' class='center'> <br> """)
27
  gr.Markdown(
28
  """<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>""")
29
 
30
  with gr.Row():
31
  num_end = gr.Number(visible=False)
32
- b1 = gr.Button("Get Initial dataframe")
33
  b2 = gr.Button("Next 10 Rows")
34
 
35
  with gr.Row():
36
- out_dataframe = gr.Dataframe(wrap=True, max_rows=10, overflow_row_behaviour= "paginate", datatype = ["markdown", "markdown", "str", "str", "str", "str", "str", "str"], interactive=False)
37
 
38
- b1.click(fn=display_df, outputs=out_dataframe, api_name="initial_dataframe")
39
  b2.click(fn=display_next10, inputs= [out_dataframe, num_end ], outputs=[out_dataframe, num_end], api_name="next_10_rows")
40
 
41
  gr.Markdown("<center>Please note that the Playground AI dataset shared on GitHub doesn't have images but links to those images. The idea is to get the maximum benefit out of this dataset and to find the best way to explore this dataset. Gradio enables us to embed markdowns within a dataframe, thus this app is able to display actual images instead of direct links(meh!). I hope you will have as much fun playing with this Space as I had building it.</center>")
42
-
43
  demo.launch(debug=True, show_error=True)
 
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>""")
28
 
29
  with gr.Row():
30
  num_end = gr.Number(visible=False)
 
31
  b2 = gr.Button("Next 10 Rows")
32
 
33
  with gr.Row():
34
+ out_dataframe = gr.Dataframe(wrap=True, row_count=(10, 'fixed'), datatype = ["markdown", "markdown", "str", "str", "str", "str", "str", "str"], interactive=False)
35
 
 
36
  b2.click(fn=display_next10, inputs= [out_dataframe, num_end ], outputs=[out_dataframe, num_end], api_name="next_10_rows")
37
 
38
  gr.Markdown("<center>Please note that the Playground AI dataset shared on GitHub doesn't have images but links to those images. The idea is to get the maximum benefit out of this dataset and to find the best way to explore this dataset. Gradio enables us to embed markdowns within a dataframe, thus this app is able to display actual images instead of direct links(meh!). I hope you will have as much fun playing with this Space as I had building it.</center>")
39
+ demo.load(fn=display_df, outputs=out_dataframe, api_name="initial_dataframe")
40
  demo.launch(debug=True, show_error=True)