suanlab commited on
Commit
ab1a214
·
1 Parent(s): e17eb0a

work around gradio schema bug

Browse files
Files changed (1) hide show
  1. app.py +6 -22
app.py CHANGED
@@ -124,9 +124,7 @@ def image_status_text(image_path: str | None, label: str) -> str:
124
  return f"{label}: image missing in this Space bundle; use question/answer metadata only or upload assets later"
125
 
126
 
127
- def task_a_payload(
128
- index: int,
129
- ) -> tuple[str | None, str, str, str, str, str, str, str, str]:
130
  if not TASK_A_ITEMS:
131
  return None, "No Task A items found.", "", "", "", "", "", "", ""
132
  item = TASK_A_ITEMS[index % len(TASK_A_ITEMS)]
@@ -144,9 +142,7 @@ def task_a_payload(
144
  )
145
 
146
 
147
- def task_b_payload(
148
- index: int,
149
- ) -> tuple[str | None, str | None, str, str, str, str, str, str, str]:
150
  if not TASK_B_ITEMS:
151
  return None, None, "No Task B items found.", "", "", "", "", "", ""
152
  item = TASK_B_ITEMS[index % len(TASK_B_ITEMS)]
@@ -164,7 +160,7 @@ def task_b_payload(
164
  )
165
 
166
 
167
- def start_session(evaluator_name: str, current_session: str | None) -> tuple[str, str]:
168
  cleaned = evaluator_name.strip()
169
  if not cleaned:
170
  cleaned = "anonymous"
@@ -174,13 +170,7 @@ def start_session(evaluator_name: str, current_session: str | None) -> tuple[str
174
  return session_id, f"Session ready: {cleaned} ({session_id})"
175
 
176
 
177
- def submit_task_a(
178
- index: int,
179
- evaluator_name: str,
180
- session_id: str,
181
- rating: str,
182
- notes: str,
183
- ) -> tuple[int, str, str | None, str, str, str, str, str, str, str, str]:
184
  if not TASK_A_ITEMS:
185
  return index, "No Task A items available.", None, "", "", "", "", "", "", "", ""
186
  if not evaluator_name.strip() or not session_id.strip():
@@ -225,13 +215,7 @@ def submit_task_a(
225
  )
226
 
227
 
228
- def submit_task_b(
229
- index: int,
230
- evaluator_name: str,
231
- session_id: str,
232
- rating: str,
233
- notes: str,
234
- ) -> tuple[int, str, str | None, str | None, str, str, str, str, str, str, str]:
235
  if not TASK_B_ITEMS:
236
  return (
237
  index,
@@ -414,4 +398,4 @@ with gr.Blocks(title="StructViz-Bench Human Evaluation") as demo:
414
 
415
 
416
  if __name__ == "__main__":
417
- demo.launch(server_name="0.0.0.0", show_api=False)
 
124
  return f"{label}: image missing in this Space bundle; use question/answer metadata only or upload assets later"
125
 
126
 
127
+ def task_a_payload(index):
 
 
128
  if not TASK_A_ITEMS:
129
  return None, "No Task A items found.", "", "", "", "", "", "", ""
130
  item = TASK_A_ITEMS[index % len(TASK_A_ITEMS)]
 
142
  )
143
 
144
 
145
+ def task_b_payload(index):
 
 
146
  if not TASK_B_ITEMS:
147
  return None, None, "No Task B items found.", "", "", "", "", "", ""
148
  item = TASK_B_ITEMS[index % len(TASK_B_ITEMS)]
 
160
  )
161
 
162
 
163
+ def start_session(evaluator_name, current_session):
164
  cleaned = evaluator_name.strip()
165
  if not cleaned:
166
  cleaned = "anonymous"
 
170
  return session_id, f"Session ready: {cleaned} ({session_id})"
171
 
172
 
173
+ def submit_task_a(index, evaluator_name, session_id, rating, notes):
 
 
 
 
 
 
174
  if not TASK_A_ITEMS:
175
  return index, "No Task A items available.", None, "", "", "", "", "", "", "", ""
176
  if not evaluator_name.strip() or not session_id.strip():
 
215
  )
216
 
217
 
218
+ def submit_task_b(index, evaluator_name, session_id, rating, notes):
 
 
 
 
 
 
219
  if not TASK_B_ITEMS:
220
  return (
221
  index,
 
398
 
399
 
400
  if __name__ == "__main__":
401
+ demo.launch(server_name="0.0.0.0", share=True, show_api=False)