edugp commited on
Commit
cdefd17
1 Parent(s): 8842af8

Output also the score

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -53,11 +53,11 @@ def score_image_caption_pair(uploaded_file, text_input):
53
  local_image_path = save_file_to_disk(uploaded_file)
54
  score = run_inference(
55
  local_image_path, text_input, model, tokenizer).tolist()
56
- return {"Score": score}
57
 
58
 
59
  image = gr.inputs.Image(shape=(299, 299))
60
  iface = gr.Interface(
61
- fn=score_image_caption_pair, inputs=[image, "text"], outputs="label"
62
  )
63
  iface.launch()
 
53
  local_image_path = save_file_to_disk(uploaded_file)
54
  score = run_inference(
55
  local_image_path, text_input, model, tokenizer).tolist()
56
+ return {"Score": score}, "{:.2f}".format(score)
57
 
58
 
59
  image = gr.inputs.Image(shape=(299, 299))
60
  iface = gr.Interface(
61
+ fn=score_image_caption_pair, inputs=[image, "text"], outputs=["label", "text"]
62
  )
63
  iface.launch()