taesiri commited on
Commit
616dc00
·
1 Parent(s): df21af6
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -37,6 +37,7 @@ def generate_json_files(
37
  question,
38
  final_answer,
39
  rationale_text,
 
40
  image1,
41
  image2,
42
  image3,
@@ -72,6 +73,7 @@ def generate_json_files(
72
  institution = safe_str(institution)
73
  openreview_profile = safe_str(openreview_profile)
74
  authorship_interest = safe_str(authorship_interest)
 
75
  # Convert question_categories to list
76
  question_categories = (
77
  [cat.strip() for cat in safe_str(question_categories).split(",")]
@@ -124,6 +126,7 @@ def generate_json_files(
124
  {"type": "field", "label": "openreview_profile", "value": openreview_profile},
125
  {"type": "field", "label": "authorship_interest", "value": authorship_interest},
126
  {"type": "field", "label": "question_categories", "value": question_categories},
 
127
  {"type": "field", "label": "subquestion_1_text", "value": subquestion_1_text},
128
  {
129
  "type": "field",
@@ -184,6 +187,7 @@ def generate_json_files(
184
  "authorship_interest": authorship_interest,
185
  },
186
  "question_categories": question_categories,
 
187
  "question": question,
188
  "question_images": [
189
  item["image_url"]["url"]["data:image/png;path"]
@@ -297,6 +301,14 @@ with gr.Blocks() as demo:
297
 
298
  gr.Markdown("## Question Information")
299
 
 
 
 
 
 
 
 
 
300
  # Question Images - Individual Tabs
301
  with gr.Tabs():
302
  with gr.Tab("Image 1"):
@@ -445,6 +457,7 @@ with gr.Blocks() as demo:
445
  q,
446
  fa,
447
  rt,
 
448
  i1,
449
  i2,
450
  i3,
@@ -466,6 +479,8 @@ with gr.Blocks() as demo:
466
  missing_fields.append("Final Answer")
467
  if not i1:
468
  missing_fields.append("First Question Image")
 
 
469
  if not sq1t or not sq1t.strip() or not sq1a or not sq1a.strip():
470
  missing_fields.append("First Sub-question and Answer")
471
  if not sq2t or not sq2t.strip() or not sq2a or not sq2a.strip():
@@ -505,6 +520,7 @@ with gr.Blocks() as demo:
505
  q,
506
  fa,
507
  rt,
 
508
  i1,
509
  i2,
510
  i3,
@@ -541,6 +557,7 @@ with gr.Blocks() as demo:
541
  question_input,
542
  final_answer_input,
543
  rationale_text_input,
 
544
  image1,
545
  image2,
546
  image3,
@@ -575,6 +592,7 @@ with gr.Blocks() as demo:
575
  gr.update(value=""), # Clear question
576
  gr.update(value=""), # Clear final answer
577
  gr.update(value=""), # Clear rationale text
 
578
  None, # Clear image1
579
  None, # Clear image2
580
  None, # Clear image3
@@ -614,6 +632,7 @@ with gr.Blocks() as demo:
614
  question_input,
615
  final_answer_input,
616
  rationale_text_input,
 
617
  image1,
618
  image2,
619
  image3,
 
37
  question,
38
  final_answer,
39
  rationale_text,
40
+ image_attribution,
41
  image1,
42
  image2,
43
  image3,
 
73
  institution = safe_str(institution)
74
  openreview_profile = safe_str(openreview_profile)
75
  authorship_interest = safe_str(authorship_interest)
76
+ image_attribution = safe_str(image_attribution)
77
  # Convert question_categories to list
78
  question_categories = (
79
  [cat.strip() for cat in safe_str(question_categories).split(",")]
 
126
  {"type": "field", "label": "openreview_profile", "value": openreview_profile},
127
  {"type": "field", "label": "authorship_interest", "value": authorship_interest},
128
  {"type": "field", "label": "question_categories", "value": question_categories},
129
+ {"type": "field", "label": "image_attribution", "value": image_attribution},
130
  {"type": "field", "label": "subquestion_1_text", "value": subquestion_1_text},
131
  {
132
  "type": "field",
 
187
  "authorship_interest": authorship_interest,
188
  },
189
  "question_categories": question_categories,
190
+ "image_attribution": image_attribution,
191
  "question": question,
192
  "question_images": [
193
  item["image_url"]["url"]["data:image/png;path"]
 
301
 
302
  gr.Markdown("## Question Information")
303
 
304
+ # image
305
+ gr.Markdown("### Image Attribution")
306
+ image_attribution_input = gr.Textbox(
307
+ label="Image Attribution",
308
+ lines=1,
309
+ placeholder="Image source or 'Own' if you created/took the image",
310
+ )
311
+
312
  # Question Images - Individual Tabs
313
  with gr.Tabs():
314
  with gr.Tab("Image 1"):
 
457
  q,
458
  fa,
459
  rt,
460
+ ia,
461
  i1,
462
  i2,
463
  i3,
 
479
  missing_fields.append("Final Answer")
480
  if not i1:
481
  missing_fields.append("First Question Image")
482
+ if not ia or not ia.strip():
483
+ missing_fields.append("Image Attribution")
484
  if not sq1t or not sq1t.strip() or not sq1a or not sq1a.strip():
485
  missing_fields.append("First Sub-question and Answer")
486
  if not sq2t or not sq2t.strip() or not sq2a or not sq2a.strip():
 
520
  q,
521
  fa,
522
  rt,
523
+ ia,
524
  i1,
525
  i2,
526
  i3,
 
557
  question_input,
558
  final_answer_input,
559
  rationale_text_input,
560
+ image_attribution_input,
561
  image1,
562
  image2,
563
  image3,
 
592
  gr.update(value=""), # Clear question
593
  gr.update(value=""), # Clear final answer
594
  gr.update(value=""), # Clear rationale text
595
+ gr.update(value=""), # Clear image attribution
596
  None, # Clear image1
597
  None, # Clear image2
598
  None, # Clear image3
 
632
  question_input,
633
  final_answer_input,
634
  rationale_text_input,
635
+ image_attribution_input,
636
  image1,
637
  image2,
638
  image3,