helloai0 commited on
Commit
f16f54b
1 Parent(s): 87adac4

Update metric.py

Browse files
Files changed (1) hide show
  1. metric.py +10 -9
metric.py CHANGED
@@ -74,21 +74,22 @@ def compute(params):
74
  print('label:', label)
75
 
76
  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:"
77
-
78
- try:
79
- response = client.completions.create(
80
  engine="gpt-3.5-turbo-instruct",
81
  prompt=prompt,
82
  temperature=0,
83
  max_tokens=1,
84
  )
85
- eval_result = response.choices[0].text.strip()
86
- print('eval_result', eval_result)
87
- score = int(eval_result)
 
 
88
 
89
- except:
90
- print("Error: API Calling")
91
- return
92
 
93
  return score
94
 
 
74
  print('label:', label)
75
 
76
  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:"
77
+
78
+ response = client.completions.create(
 
79
  engine="gpt-3.5-turbo-instruct",
80
  prompt=prompt,
81
  temperature=0,
82
  max_tokens=1,
83
  )
84
+ eval_result = response.choices[0].text.strip()
85
+ print('eval_result', eval_result)
86
+ score = int(eval_result)
87
+ # try:
88
+
89
 
90
+ # except:
91
+ # print("Error: API Calling")
92
+ # return
93
 
94
  return score
95