ysharma HF staff commited on
Commit
39adbdc
1 Parent(s): adb2480

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -128,9 +128,9 @@ with gr.Blocks() as demo:
128
  )
129
  with gr.Column():
130
  with gr.Row():
131
- b1 = gr.Button("Previous")
132
  b2 = gr.Button("Next")
133
- reka = gr.Dataframe(value=df_markdown[0:5], datatype=['markdown', 'str'], wrap=False, interactive=False, height=500)
134
  num_start = gr.Number(visible=False, value=0)
135
  num_end = gr.Number(visible=False, value=4)
136
 
@@ -139,10 +139,10 @@ with gr.Blocks() as demo:
139
  #bot_msg.then(lambda: gr.MultimodalTextbox(interactive=True), None, [chat_input])
140
  #chatbot.like(print_like_dislike, None, None)
141
 
142
- def get_example(reka, evt: gr.SelectData):
143
  print(f'evt.value = {evt.value}')
144
  print(f'evt.index = {evt.index}')
145
- x = evt.index[0]
146
  image = df.iloc[x, 0]
147
  prompt = df.iloc[x, 1]
148
  print(f'image = {image}')
@@ -168,7 +168,7 @@ with gr.Blocks() as demo:
168
  print(f'returned value of end = {end}')
169
  return df_images, end, start, gr.Button(interactive=False) if start==0 else gr.Button(interactive=True)
170
 
171
- reka.select(get_example, reka, chat_input, show_progress="hidden")
172
  b2.click(fn=display_next, inputs= [reka, num_end ], outputs=[reka, num_end, num_start, b1], api_name="next_rows", show_progress=False)
173
  b1.click(fn=display_previous, inputs= [reka, num_start ], outputs=[reka, num_end, num_start, b1], api_name="previous_rows")
174
 
 
128
  )
129
  with gr.Column():
130
  with gr.Row():
131
+ b1 = gr.Button("Previous", interactive=False)
132
  b2 = gr.Button("Next")
133
+ reka = gr.Dataframe(value=df_markdown[0:5], datatype=['markdown', 'str'], wrap=False, interactive=False, height=700)
134
  num_start = gr.Number(visible=False, value=0)
135
  num_end = gr.Number(visible=False, value=4)
136
 
 
139
  #bot_msg.then(lambda: gr.MultimodalTextbox(interactive=True), None, [chat_input])
140
  #chatbot.like(print_like_dislike, None, None)
141
 
142
+ def get_example(reka, start, evt: gr.SelectData):
143
  print(f'evt.value = {evt.value}')
144
  print(f'evt.index = {evt.index}')
145
+ x = evt.index[0] + start
146
  image = df.iloc[x, 0]
147
  prompt = df.iloc[x, 1]
148
  print(f'image = {image}')
 
168
  print(f'returned value of end = {end}')
169
  return df_images, end, start, gr.Button(interactive=False) if start==0 else gr.Button(interactive=True)
170
 
171
+ reka.select(get_example, [reka,start] chat_input, show_progress="hidden")
172
  b2.click(fn=display_next, inputs= [reka, num_end ], outputs=[reka, num_end, num_start, b1], api_name="next_rows", show_progress=False)
173
  b1.click(fn=display_previous, inputs= [reka, num_start ], outputs=[reka, num_end, num_start, b1], api_name="previous_rows")
174