Csplk commited on
Commit
fefde70
β€’
1 Parent(s): ee5e19e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -22,9 +22,9 @@ moondream.eval()
22
  def answer_questions(image_tuples, prompt_text):
23
  result = ""
24
 
25
- print(f"prompt_text: {prompt_text}\n")
26
  prompts = [p.strip() for p in prompt_text.split(',')] # Splitting and cleaning prompts
27
- print(f"prompts: {prompts}\n")
28
 
29
  image_embeds = [img[0] for img in image_tuples if img[0] is not None] # Extracting images from tuples, ignoring None
30
 
@@ -39,16 +39,18 @@ def answer_questions(image_tuples, prompt_text):
39
  )
40
 
41
  for question, answer in zip(prompts, answers):
42
- print(f"Q: {question}")
43
- print(f"A: {answer}")
44
- print()
45
  result += (f"Q: {question}\nA: {answer}\n\n")
46
 
47
  return result
48
 
49
  with gr.Blocks() as demo:
50
  gr.Markdown("# moondream2 unofficial batch processing demo")
51
- gr.Markdown("# πŸŒ” moondream2\nA tiny vision language model. [GitHub](https://github.com/vikhyatk/moondream)")
 
 
52
  with gr.Row():
53
  img = gr.Gallery(label="Upload Images", type="pil")
54
  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=2)
 
22
  def answer_questions(image_tuples, prompt_text):
23
  result = ""
24
 
25
+ #print(f"prompt_text: {prompt_text}\n")
26
  prompts = [p.strip() for p in prompt_text.split(',')] # Splitting and cleaning prompts
27
+ #print(f"prompts: {prompts}\n")
28
 
29
  image_embeds = [img[0] for img in image_tuples if img[0] is not None] # Extracting images from tuples, ignoring None
30
 
 
39
  )
40
 
41
  for question, answer in zip(prompts, answers):
42
+ #print(f"Q: {question}")
43
+ #print(f"A: {answer}")
44
+ #print()
45
  result += (f"Q: {question}\nA: {answer}\n\n")
46
 
47
  return result
48
 
49
  with gr.Blocks() as demo:
50
  gr.Markdown("# moondream2 unofficial batch processing demo")
51
+ gr.Markdown("1. Select images\n2. Enter prompts (one prompt for each image provided) separated by commas. Ex: Describe this image, What is in this image?\n\n")
52
+ gr.Markdown("*Tested and Running on free CPU space tier currently so results may take a bit to process compared to using GPU space hardware*")
53
+ gr.Markdown("## πŸŒ” moondream2\nA tiny vision language model. [GitHub](https://github.com/vikhyatk/moondream)")
54
  with gr.Row():
55
  img = gr.Gallery(label="Upload Images", type="pil")
56
  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=2)