Jietson commited on
Commit
7d3bba0
·
verified ·
1 Parent(s): 4195aa6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +33 -22
README.md CHANGED
@@ -1,4 +1,7 @@
1
  ---
 
 
 
2
  dataset_info:
3
  features:
4
  - name: question_id
@@ -58,15 +61,17 @@ You can find our dataset on huggingface: 🤗[InfoChartQA Dataset](https://huggi
58
  Each question entry is arranged as:
59
 
60
  ```
61
- --question_id: int
62
- --qtype: int
63
- --figure_path: image
64
- --visual_figure_path: list of image
65
- --question: str
66
- --answer: str
67
- --instructions: str
68
- --prompt: str
69
- --options: list of dict ("A/B/C/D":"option_content")
 
 
70
  ```
71
 
72
  Each question is built as:
@@ -97,19 +102,25 @@ def build_question(query):#to build the question
97
  with open("visual_basic.json","r",encode="utf-8") as f:
98
  queries = json.load(f)
99
 
100
- for idx in range(queries):
101
- question = build_question(queries[idx])
102
- figure_path = [queries[idx]['figure_path']]
103
- visual_figure_path = queries[idx]['visual_figure_path']
104
-
105
- response = model.generate(question, [figure_path, visual_figure_path])# generate model's response based on
106
-
107
- queries[idx]["response"] = reponse
108
-
109
- with open("model_reponse.json","w",encode="utf-8") as f:
110
- json.dump(queries, f)
111
- from checker import evaluate
112
- evaluate("model_reponse.json", "path_to_save_the_result")
 
 
 
 
 
 
113
  ```
114
 
115
 
 
1
  ---
2
+ license: cc-by-4.0
3
+ ---
4
+ ---
5
  dataset_info:
6
  features:
7
  - name: question_id
 
61
  Each question entry is arranged as:
62
 
63
  ```
64
+ "question_id": id of the question,
65
+ "qtype": type of the question, for example: "rank" questions
66
+ "figure_path": local path of the image if you download the image,
67
+ "question": question,
68
+ "answer": answer,
69
+ "instructions": instructions,
70
+ "url": url of the image,
71
+ "bbox": bbox of the image, this is used for visual questions. Images with bbox should be cropped based on the bbox. bbox is formatted as [xmin, ymin, width, height] with no normalization.
72
+ "parent": the original image of the cropped image,
73
+ "difficulty": difficulty level,
74
+ "chart_type": chart_type,
75
  ```
76
 
77
  Each question is built as:
 
102
  with open("visual_basic.json","r",encode="utf-8") as f:
103
  queries = json.load(f)
104
 
105
+ for query in tqdm(queries):
106
+ query_idx = query["question_id"]
107
+ question_text = build_question(query)
108
+ chart_figure = query["url"] # This should be a list of url
109
+ visual_figure = query.get("visual_figure_path",[])
110
+
111
+ # Replace with your model
112
+ response = model.generate(question_text, chart_figure + visual_figure)
113
+
114
+
115
+ Responses[query_idx] = {
116
+ "qtype": int(query["qtype"]),
117
+ "answer": query["answer"],
118
+ "question_id": query_idx,
119
+ "response": response,
120
+ }
121
+
122
+ with open("./model_response.json", "w", encoding="utf-8") as f:
123
+ json.dump(Responses, f, indent = 2, ensure_ascii=False)
124
  ```
125
 
126