Update metric.py
Browse files
metric.py
CHANGED
@@ -69,6 +69,7 @@ def compute(params):
|
|
69 |
print('output', output)
|
70 |
answer = output['pred']
|
71 |
label = str(targets.iloc[row]['pred'])
|
|
|
72 |
|
73 |
prompt=f"Give me a score from 1 to 10 (higher is better) judging how similar these two captions are. Caption one: {answer}. Caption two: {label}\nScore:"
|
74 |
|
@@ -79,8 +80,9 @@ def compute(params):
|
|
79 |
temperature=0,
|
80 |
max_tokens=1,
|
81 |
)
|
82 |
-
|
83 |
-
|
|
|
84 |
|
85 |
except:
|
86 |
print("Error: API Calling")
|
|
|
69 |
print('output', output)
|
70 |
answer = output['pred']
|
71 |
label = str(targets.iloc[row]['pred'])
|
72 |
+
print('answer', answer)
|
73 |
|
74 |
prompt=f"Give me a score from 1 to 10 (higher is better) judging how similar these two captions are. Caption one: {answer}. Caption two: {label}\nScore:"
|
75 |
|
|
|
80 |
temperature=0,
|
81 |
max_tokens=1,
|
82 |
)
|
83 |
+
eval_result = response.choices[0].text.strip()
|
84 |
+
print('eval_result', eval_result)
|
85 |
+
score = int(eval_result)
|
86 |
|
87 |
except:
|
88 |
print("Error: API Calling")
|