yonatanbitton commited on
Commit
c2f1a80
1 Parent(s): 4fe563b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -52,6 +52,7 @@ def display_next(dataframe, end):
52
  assert len(df_images) == LINES_NUMBER
53
  return df_images, end
54
 
 
55
  # Gradio Blocks
56
  with gr.Blocks() as demo:
57
  gr.Markdown("<h1><center>WHOOPS! Dataset Viewer</center></h1>")
@@ -62,12 +63,12 @@ with gr.Blocks() as demo:
62
  b2 = gr.Button("Next Rows")
63
 
64
  with gr.Row():
65
- out_dataframe = gr.Dataframe(wrap=True, max_rows=LINES_NUMBER, overflow_row_behaviour="paginate",
66
  datatype=["markdown", "markdown", "str", "str", "str", "str", "str", "str","str","str"],
67
- interactive=False)
68
 
69
  b1.click(fn=display_df, outputs=out_dataframe, api_name="initial_dataframe")
70
  b2.click(fn=display_next, inputs=[out_dataframe, num_end], outputs=[out_dataframe, num_end],
71
  api_name="next_rows")
72
 
73
- demo.launch(on_launch=display_df, debug=True, show_error=True)
 
52
  assert len(df_images) == LINES_NUMBER
53
  return df_images, end
54
 
55
+ initial_dataframe = display_df() # add
56
  # Gradio Blocks
57
  with gr.Blocks() as demo:
58
  gr.Markdown("<h1><center>WHOOPS! Dataset Viewer</center></h1>")
 
63
  b2 = gr.Button("Next Rows")
64
 
65
  with gr.Row():
66
+ out_dataframe = gr.Dataframe(initial_dataframe, wrap=True, max_rows=LINES_NUMBER, overflow_row_behaviour="paginate",
67
  datatype=["markdown", "markdown", "str", "str", "str", "str", "str", "str","str","str"],
68
+ interactive=False) # add initial dataframe before
69
 
70
  b1.click(fn=display_df, outputs=out_dataframe, api_name="initial_dataframe")
71
  b2.click(fn=display_next, inputs=[out_dataframe, num_end], outputs=[out_dataframe, num_end],
72
  api_name="next_rows")
73
 
74
+ demo.launch(debug=True, show_error=True)