Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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(
|
| 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=
|
| 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()
|