Csplk commited on
Commit
aae971d
β€’
1 Parent(s): 1635aec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -22,8 +22,8 @@ moondream.eval()
22
  def answer_questions(image_tuples, prompt_text):
23
  result = ""
24
  Q_and_A = ""
25
- prompts = [p.strip() for p in prompt_text.split(',')] # Splitting and cleaning prompts
26
- image_embeds = [img[0] for img in image_tuples if img[0] is not None] # Extracting images from tuples, ignoring None
27
 
28
  print(f"\nprompts: {prompts}\n\n")
29
  answers = []
@@ -39,10 +39,10 @@ def answer_questions(image_tuples, prompt_text):
39
  Q_and_A += f"### Q: {prompt}\n"
40
  for j, image_tuple in enumerate(image_tuples):
41
  image_name = f"image{j+1}"
42
- answer_text = answers[i][j] # Retrieve the answer for the i-th prompt for the j-th image
43
  Q_and_A += f"**{image_name} A:** \n {answer_text} \n\n"
44
 
45
- result = {'headers': prompts, 'data': answers} # Updated result handling
46
  print(f"result\n{result}\n\nQ_and_A\n{Q_and_A}\n\n")
47
  return Q_and_A, result
48
 
 
22
  def answer_questions(image_tuples, prompt_text):
23
  result = ""
24
  Q_and_A = ""
25
+ prompts = [p.strip() for p in prompt_text.split(',')]
26
+ image_embeds = [img[0] for img in image_tuples if img[0] is not None]
27
 
28
  print(f"\nprompts: {prompts}\n\n")
29
  answers = []
 
39
  Q_and_A += f"### Q: {prompt}\n"
40
  for j, image_tuple in enumerate(image_tuples):
41
  image_name = f"image{j+1}"
42
+ answer_text = answers[i][j]
43
  Q_and_A += f"**{image_name} A:** \n {answer_text} \n\n"
44
 
45
+ result = {'headers': prompts, 'data': answers}
46
  print(f"result\n{result}\n\nQ_and_A\n{Q_and_A}\n\n")
47
  return Q_and_A, result
48