Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import pipeline
|
|
@@ -5,7 +6,7 @@ from PIL import Image
|
|
| 5 |
from transformers import Pix2StructForConditionalGeneration, Pix2StructProcessor
|
| 6 |
|
| 7 |
# Load model and processor
|
| 8 |
-
model = Pix2StructForConditionalGeneration.from_pretrained("google/pix2struct-screen2words-large",
|
| 9 |
processor = Pix2StructProcessor.from_pretrained("google/pix2struct-screen2words-large")
|
| 10 |
|
| 11 |
# Define the function
|
|
|
|
| 1 |
+
import torch
|
| 2 |
import spaces
|
| 3 |
import gradio as gr
|
| 4 |
from transformers import pipeline
|
|
|
|
| 6 |
from transformers import Pix2StructForConditionalGeneration, Pix2StructProcessor
|
| 7 |
|
| 8 |
# Load model and processor
|
| 9 |
+
model = Pix2StructForConditionalGeneration.from_pretrained("google/pix2struct-screen2words-large", dtype=torch.bfloat16).to("cuda")
|
| 10 |
processor = Pix2StructProcessor.from_pretrained("google/pix2struct-screen2words-large")
|
| 11 |
|
| 12 |
# Define the function
|