foxtrot126 commited on
Commit
f6b4289
·
verified ·
1 Parent(s): db4755b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -19,7 +19,7 @@ def process_image(image, prompt):
19
  output = model.generate(**inputs, max_new_tokens=10)
20
 
21
  # Decode and return the output
22
- decoded_output = processor.batch_decode(generated_ids, skip_special_tokens=True)[0].strip()
23
 
24
  # Return the answer (exclude the prompt part from output)
25
  return decoded_output[len(prompt):]
@@ -34,6 +34,6 @@ inputs = [
34
  ]
35
  outputs = gr.Textbox(label="Answer")
36
  # Create the Gradio app
37
- demo = gr.Interface(fn=process_image, inputs=inputs, outputs=decoded_output, title="Visual Question Answering", description="Upload an image and ask questions to get answers.")
38
  # Launch the app
39
  demo.launch()
 
19
  output = model.generate(**inputs, max_new_tokens=10)
20
 
21
  # Decode and return the output
22
+ decoded_output = processor.batch_decode(output, skip_special_tokens=True)[0].strip()
23
 
24
  # Return the answer (exclude the prompt part from output)
25
  return decoded_output[len(prompt):]
 
34
  ]
35
  outputs = gr.Textbox(label="Answer")
36
  # Create the Gradio app
37
+ demo = gr.Interface(fn=process_image, inputs=inputs, outputs=outputs, title="Visual Question Answering", description="Upload an image and ask questions to get answers.")
38
  # Launch the app
39
  demo.launch()