Update app.py
Browse files
app.py
CHANGED
|
@@ -13,9 +13,9 @@ processor = Pix2StructProcessor.from_pretrained("google/pix2struct-screen2words-
|
|
| 13 |
# Define the function
|
| 14 |
@spaces.GPU
|
| 15 |
def describe_ui(image):
|
| 16 |
-
inputs = processor(images=image, text="
|
| 17 |
predictions = model.generate(**inputs)
|
| 18 |
-
return processor.decode(predictions[0], skip_special_tokens=
|
| 19 |
|
| 20 |
# Launch the Gradio interface
|
| 21 |
gr.Interface(
|
|
|
|
| 13 |
# Define the function
|
| 14 |
@spaces.GPU
|
| 15 |
def describe_ui(image):
|
| 16 |
+
inputs = processor(images=image, text="This is an image of ", return_tensors="pt").to(dtype=torch.bfloat16, device="cuda")
|
| 17 |
predictions = model.generate(**inputs)
|
| 18 |
+
return processor.decode(predictions[0], skip_special_tokens=False)
|
| 19 |
|
| 20 |
# Launch the Gradio interface
|
| 21 |
gr.Interface(
|