xiezhihui.x commited on
Commit
66e524b
β€’
1 Parent(s): 293b74a

fix out of range error

Browse files
Files changed (1) hide show
  1. data_reviewer.py +26 -11
data_reviewer.py CHANGED
@@ -70,49 +70,64 @@ def create_data_viewer():
70
  initial_split = "test"
71
  initial_idx = 0
72
  initial_data = load_and_display_sample(initial_split, initial_idx)
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  with gr.Column():
75
  with gr.Row():
76
  dataset_split = gr.Radio(choices=["test"], value=initial_split, label="Dataset Split")
77
  sample_idx = gr.Number(label="Sample Index", value=initial_idx, minimum=0, step=1, interactive=True)
78
  total_samples = gr.Textbox(
79
- label="Total Samples", value=initial_data[12], interactive=False # Set initial total samples
80
  )
81
 
82
  with gr.Row():
83
  with gr.Column():
84
- image = gr.Image(label="Sample Image", type="pil", value=initial_data[0]) # Set initial image
85
- query = gr.Textbox(label="Query", value=initial_data[6], interactive=False) # Set initial query
86
 
87
  with gr.Column():
88
  sample_id = gr.Textbox(
89
- label="Sample ID", value=initial_data[1], interactive=False # Set initial sample ID
90
  )
91
  chosen_response = gr.TextArea(
92
- label="Chosen Response βœ…", value=initial_data[2], interactive=False # Set initial chosen response
 
 
93
  )
94
  rejected_response = gr.TextArea(
95
  label="Rejected Response ❌",
96
- value=initial_data[3], # Set initial rejected response
97
  interactive=False,
98
  )
99
 
100
  with gr.Row(visible=not IGNORE_DETAILS):
101
- judge = gr.Textbox(label="Judge", value=initial_data[4], interactive=False) # Set initial judge
102
  query_source = gr.Textbox(
103
- label="Query Source", value=initial_data[5], interactive=False # Set initial query source
104
  )
105
 
106
  with gr.Row(visible=not IGNORE_DETAILS):
107
  with gr.Column():
108
- models_json = gr.JSON(label="Models", value=json.loads(initial_data[7])) # Set initial models
109
  rationale = gr.TextArea(
110
- label="Rationale", value=initial_data[9], interactive=False # Set initial rationale
111
  )
112
 
113
  with gr.Column():
114
  ground_truth = gr.TextArea(
115
- label="Ground Truth", value=initial_data[11], interactive=False # Set initial ground truth
116
  )
117
 
118
  # Auto-update when any input changes
 
70
  initial_split = "test"
71
  initial_idx = 0
72
  initial_data = load_and_display_sample(initial_split, initial_idx)
73
+ (
74
+ init_image,
75
+ init_sample_id,
76
+ init_chosen_response,
77
+ init_rejected_response,
78
+ init_judge,
79
+ init_query_source,
80
+ init_query,
81
+ init_models_json,
82
+ init_rationale,
83
+ init_ground_truth,
84
+ init_total_samples,
85
+ ) = initial_data
86
 
87
  with gr.Column():
88
  with gr.Row():
89
  dataset_split = gr.Radio(choices=["test"], value=initial_split, label="Dataset Split")
90
  sample_idx = gr.Number(label="Sample Index", value=initial_idx, minimum=0, step=1, interactive=True)
91
  total_samples = gr.Textbox(
92
+ label="Total Samples", value=init_total_samples, interactive=False # Set initial total samples
93
  )
94
 
95
  with gr.Row():
96
  with gr.Column():
97
+ image = gr.Image(label="Sample Image", type="pil", value=init_image) # Set initial image
98
+ query = gr.Textbox(label="Query", value=init_query, interactive=False) # Set initial query
99
 
100
  with gr.Column():
101
  sample_id = gr.Textbox(
102
+ label="Sample ID", value=init_sample_id, interactive=False # Set initial sample ID
103
  )
104
  chosen_response = gr.TextArea(
105
+ label="Chosen Response βœ…",
106
+ value=init_chosen_response,
107
+ interactive=False, # Set initial chosen response
108
  )
109
  rejected_response = gr.TextArea(
110
  label="Rejected Response ❌",
111
+ value=init_rejected_response, # Set initial rejected response
112
  interactive=False,
113
  )
114
 
115
  with gr.Row(visible=not IGNORE_DETAILS):
116
+ judge = gr.Textbox(label="Judge", value=init_judge, interactive=False) # Set initial judge
117
  query_source = gr.Textbox(
118
+ label="Query Source", value=init_query_source, interactive=False # Set initial query source
119
  )
120
 
121
  with gr.Row(visible=not IGNORE_DETAILS):
122
  with gr.Column():
123
+ models_json = gr.JSON(label="Models", value=json.loads(init_models_json)) # Set initial models
124
  rationale = gr.TextArea(
125
+ label="Rationale", value=init_rationale, interactive=False # Set initial rationale
126
  )
127
 
128
  with gr.Column():
129
  ground_truth = gr.TextArea(
130
+ label="Ground Truth", value=init_ground_truth, interactive=False # Set initial ground truth
131
  )
132
 
133
  # Auto-update when any input changes