Update util.py
Browse files
util.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
|
|
| 1 |
import pandas as pd
|
| 2 |
-
|
| 3 |
from openai import OpenAI
|
| 4 |
|
| 5 |
def get_questions(file_path):
|
|
@@ -12,6 +12,10 @@ def get_questions(file_path):
|
|
| 12 |
|
| 13 |
return result
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
def get_final_answer(model, question, answer):
|
| 16 |
prompt_template = """
|
| 17 |
You are an expert question answering assistant. Given a question and an initial answer, your task is to provide the final answer.
|
|
|
|
| 1 |
+
import base64
|
| 2 |
import pandas as pd
|
|
|
|
| 3 |
from openai import OpenAI
|
| 4 |
|
| 5 |
def get_questions(file_path):
|
|
|
|
| 12 |
|
| 13 |
return result
|
| 14 |
|
| 15 |
+
get_img_b64(file_path):
|
| 16 |
+
with open(file_path, "rb") as file:
|
| 17 |
+
return base64.b64encode(file.read()).decode("utf-8")
|
| 18 |
+
|
| 19 |
def get_final_answer(model, question, answer):
|
| 20 |
prompt_template = """
|
| 21 |
You are an expert question answering assistant. Given a question and an initial answer, your task is to provide the final answer.
|