awacke1 commited on
Commit
95288f7
1 Parent(s): 659ed1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -6,13 +6,13 @@ df['url'] = df['url'].apply(lambda x: '<a href= "' + str(x) + '" target="_blank"
6
  df = df[[ 'url', 'prompt']]
7
 
8
  def display_df():
9
- df_images = df.head(100)
10
  return df_images
11
 
12
- def display_next100(dataframe, end):
13
  dataframe = dataframe.sample(frac=1)
14
  start = (end or dataframe.index[-1]) + 1
15
- end = start + 99
16
  df_images = df.loc[start:end]
17
  return df_images, end
18
 
@@ -22,13 +22,13 @@ with gr.Blocks() as demo:
22
 
23
  with gr.Row():
24
  num_end = gr.Number(visible=False)
25
- b1 = gr.Button("Images and Prompts 0-100")
26
- b2 = gr.Button("Next 100 Images and Prompts")
27
 
28
  with gr.Row():
29
- out_dataframe = gr.Dataframe(wrap=True, max_rows=100, overflow_row_behaviour= "paginate", datatype = ["markdown", "markdown"], headers=['url', 'prompt'])
30
 
31
  b1.click(fn=display_df, outputs=out_dataframe)
32
- b2.click(fn=display_next100, inputs= [out_dataframe, num_end ], outputs=[out_dataframe, num_end])
33
 
34
  demo.launch(debug=True, show_error=True)
 
6
  df = df[[ 'url', 'prompt']]
7
 
8
  def display_df():
9
+ df_images = df.head(1000)
10
  return df_images
11
 
12
+ def display_next1000(dataframe, end):
13
  dataframe = dataframe.sample(frac=1)
14
  start = (end or dataframe.index[-1]) + 1
15
+ end = start + 999
16
  df_images = df.loc[start:end]
17
  return df_images, end
18
 
 
22
 
23
  with gr.Row():
24
  num_end = gr.Number(visible=False)
25
+ b1 = gr.Button("Images and Prompts 0-1000")
26
+ b2 = gr.Button("Next 1000 Images and Prompts")
27
 
28
  with gr.Row():
29
+ out_dataframe = gr.Dataframe(wrap=True, max_rows=1000, overflow_row_behaviour= "paginate", datatype = ["markdown", "markdown"], headers=['url', 'prompt'])
30
 
31
  b1.click(fn=display_df, outputs=out_dataframe)
32
+ b2.click(fn=display_next1000, inputs= [out_dataframe, num_end ], outputs=[out_dataframe, num_end])
33
 
34
  demo.launch(debug=True, show_error=True)