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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -40,7 +40,7 @@ def answer_questions(image_tuples, prompt_text):
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")
@@ -53,13 +53,15 @@ with gr.Blocks() as demo:
53
  gr.Markdown("*Running on free CPU space tier currently so results may take a bit to process compared to duplicating space and using GPU space hardware*")
54
  gr.Markdown("## πŸŒ” moondream2\nA tiny vision language model. [GitHub](https://github.com/vikhyatk/moondream)")
55
  with gr.Row():
56
- img = gr.Gallery(label="Upload Images", type="pil", preview=True, object_fit="scale-down")
57
  with gr.Row():
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", line_breaks=True)
62
- output2 = gr.Dataframe(label="Structured Dataframe", type="array", wrap=True)
 
 
63
  submit.click(answer_questions, [img, prompt], [output, output2])
64
 
65
  demo.queue().launch()
 
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")
 
53
  gr.Markdown("*Running on free CPU space tier currently so results may take a bit to process compared to duplicating space and using GPU space hardware*")
54
  gr.Markdown("## πŸŒ” moondream2\nA tiny vision language model. [GitHub](https://github.com/vikhyatk/moondream)")
55
  with gr.Row():
56
+ img = gr.Gallery(label="Upload Images", type="pil", preview=True, columns=4)
57
  with gr.Row():
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
+ with gr.Row():
62
+ output = gr.Markdown(label="Questions and Answers", line_breaks=True)
63
+ with gr.Row():
64
+ output2 = gr.Dataframe(label="Structured Dataframe", type="array", wrap=True)
65
  submit.click(answer_questions, [img, prompt], [output, output2])
66
 
67
  demo.queue().launch()