xxx1 commited on
Commit
72dd6ac
1 Parent(s): 243e8f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -51,6 +51,19 @@ def gpt3_short(question,vqa_answer,caption):
51
  temperature=0.7,
52
  )
53
  answer = response.choices[0].text.strip()
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  return answer
56
  def gpt3(question,vqa_answer,caption):
 
51
  temperature=0.7,
52
  )
53
  answer = response.choices[0].text.strip()
54
+
55
+ llm_ans=answer
56
+ choice=set(["A","B","C","D"])
57
+ llm_ans=llm_ans.replace("\n"," ").replace(":"," ").replace("."," " ).replace(","," ")
58
+ sllm_ans=llm_ans.split(" ")
59
+ for cho in sllm_ans:
60
+ if cho in choice:
61
+ llm_ans=cho
62
+ break
63
+ if llm_ans not in choice:
64
+ llm_ans="A"
65
+ llm_ans=vqa_answer[ord(llm_ans)-ord("A")]
66
+ answer=llm_ans
67
 
68
  return answer
69
  def gpt3(question,vqa_answer,caption):