ysharma HF Staff commited on
Commit
5dc3275
·
verified ·
1 Parent(s): eea41dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -13,8 +13,8 @@ import pandas as pd
13
  rekaeval = "RekaAI/VibeEval"
14
  dataset = load_dataset(rekaeval, split="test")
15
  df = pd.DataFrame(dataset)
16
- df = df[['media_url', 'prompt']]
17
- df_markdown = df.copy()
18
 
19
  # Function to convert URL to HTML img tag
20
  def mediaurl_to_img_tag(url):
@@ -132,6 +132,8 @@ with gr.Blocks(fill_height=True, css=CSS) as demo:
132
  chatbot=chatbot,
133
  )
134
  with gr.Column():
 
 
135
  with gr.Row():
136
  b1 = gr.Button("Previous", interactive=False)
137
  b2 = gr.Button("Next")
@@ -145,10 +147,11 @@ with gr.Blocks(fill_height=True, css=CSS) as demo:
145
  x = evt.index[0] + start
146
  image = df.iloc[x, 0]
147
  prompt = df.iloc[x, 1]
 
148
  print(f'image = {image}')
149
  print(f'prompt = {prompt}')
150
  example = {"text": prompt, "files": [image]}
151
- return example
152
 
153
  def display_next(dataframe, end):
154
  print(f'initial value of end = {end}')
@@ -168,7 +171,7 @@ with gr.Blocks(fill_height=True, css=CSS) 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,num_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
 
 
13
  rekaeval = "RekaAI/VibeEval"
14
  dataset = load_dataset(rekaeval, split="test")
15
  df = pd.DataFrame(dataset)
16
+ df = df[['media_url', 'prompt', 'reference']]
17
+ df_markdown = df[['media_url', 'prompt']].copy()
18
 
19
  # Function to convert URL to HTML img tag
20
  def mediaurl_to_img_tag(url):
 
132
  chatbot=chatbot,
133
  )
134
  with gr.Column():
135
+ with gr.Accordion('Open for looking at Ground Truth:', open=False):
136
+ refernce = gr.Markdown()
137
  with gr.Row():
138
  b1 = gr.Button("Previous", interactive=False)
139
  b2 = gr.Button("Next")
 
147
  x = evt.index[0] + start
148
  image = df.iloc[x, 0]
149
  prompt = df.iloc[x, 1]
150
+ refrence = df.iloc[x, 2]
151
  print(f'image = {image}')
152
  print(f'prompt = {prompt}')
153
  example = {"text": prompt, "files": [image]}
154
+ return example, refernce
155
 
156
  def display_next(dataframe, end):
157
  print(f'initial value of end = {end}')
 
171
  print(f'returned value of end = {end}')
172
  return df_images, end, start, gr.Button(interactive=False) if start==0 else gr.Button(interactive=True)
173
 
174
+ reka.select(get_example, [reka,num_start], [chat_input, refernce], show_progress="hidden")
175
  b2.click(fn=display_next, inputs= [reka, num_end ], outputs=[reka, num_end, num_start, b1], api_name="next_rows", show_progress=False)
176
  b1.click(fn=display_previous, inputs= [reka, num_start ], outputs=[reka, num_end, num_start, b1], api_name="previous_rows")
177