Csplk commited on
Commit
f2ab852
β€’
1 Parent(s): 3f71d24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -36,11 +36,11 @@ def answer_questions(image_tuples, prompt_text):
36
  answers.append(image_answers)
37
 
38
  for i, prompt in enumerate(prompts):
39
- Q_and_A += f"Q: {prompt}\n\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")
@@ -58,7 +58,7 @@ with gr.Blocks() as demo:
58
  prompt = gr.Textbox(label="Input Prompts", placeholder="Enter prompts (one prompt for each image provided) separated by commas. Ex: Describe this image, What is in this image?", lines=8)
59
  with gr.Row():
60
  submit = gr.Button("Submit")
61
- output = gr.TextArea(label="Questions and Answers", lines=30)
62
  output2 = gr.Dataframe(label="Structured Dataframe", type="array",wrap=True)
63
  submit.click(answer_questions, [img, prompt], [output, output2])
64
 
 
36
  answers.append(image_answers)
37
 
38
  for i, prompt in enumerate(prompts):
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")
 
58
  prompt = gr.Textbox(label="Input Prompts", placeholder="Enter prompts (one prompt for each image provided) separated by commas. Ex: Describe this image, What is in this image?", lines=8)
59
  with gr.Row():
60
  submit = gr.Button("Submit")
61
+ output = gr.Markdown(label="Questions and Answers")
62
  output2 = gr.Dataframe(label="Structured Dataframe", type="array",wrap=True)
63
  submit.click(answer_questions, [img, prompt], [output, output2])
64