taesiri commited on
Commit
6a483a1
1 Parent(s): bf97e6c
Files changed (2) hide show
  1. .gitattributes +3 -0
  2. app.py +13 -1
.gitattributes CHANGED
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ df_final.pkl filter=lfs diff=lfs merge=lfs -text
37
+ batch_uPF4cMRPVfoUJk2d4Xgrypa8_output.jsonl filter=lfs diff=lfs merge=lfs -text
38
+ gpt4o_mini_dataset.jsonl filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -1,6 +1,8 @@
1
  import gradio as gr
2
  import pandas as pd
3
  from datasets import load_dataset
 
 
4
 
5
  df_final = pd.read_pickle("./df_final.pkl")
6
  dataset = load_dataset("XAI/vlmsareblind")
@@ -11,13 +13,23 @@ def show_row(row_index, selected_task):
11
  row = task_df.iloc[int(row_index)]
12
  custom_id = int(row["custom_id"])
13
  image = dataset["valid"][custom_id]["image"]
 
 
 
 
 
 
 
 
 
 
14
  prompt = dataset["valid"][custom_id]["prompt"]
15
  model_output = row["content_raw"]
16
  ground_truth = row["gt"]
17
  task = row["task"]
18
  is_correct = row["is_correct"]
19
 
20
- return image, prompt, model_output, ground_truth, task, is_correct
21
 
22
 
23
  def update_slider(selected_task):
 
1
  import gradio as gr
2
  import pandas as pd
3
  from datasets import load_dataset
4
+ from PIL import Image, ImageOps
5
+
6
 
7
  df_final = pd.read_pickle("./df_final.pkl")
8
  dataset = load_dataset("XAI/vlmsareblind")
 
13
  row = task_df.iloc[int(row_index)]
14
  custom_id = int(row["custom_id"])
15
  image = dataset["valid"][custom_id]["image"]
16
+
17
+ # Add white padding to the image
18
+ original_size = image.size
19
+ new_size = (original_size[0] * 2, original_size[1] * 2)
20
+ padding = (
21
+ (new_size[0] - original_size[0]) // 2,
22
+ (new_size[1] - original_size[1]) // 2,
23
+ )
24
+ image_with_padding = ImageOps.expand(image, border=padding, fill="white")
25
+
26
  prompt = dataset["valid"][custom_id]["prompt"]
27
  model_output = row["content_raw"]
28
  ground_truth = row["gt"]
29
  task = row["task"]
30
  is_correct = row["is_correct"]
31
 
32
+ return image_with_padding, prompt, model_output, ground_truth, task, is_correct
33
 
34
 
35
  def update_slider(selected_task):