Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Saroj Dhiman
/
invoice information extractor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 69c92f3b
authored
Nov 20, 2023
by
Saroj Dhiman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update model_2.py
1 parent
3e4cce28
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
model_2.py
model_2.py
View file @
69c92f3
...
@@ -11,8 +11,8 @@ import time
...
@@ -11,8 +11,8 @@ import time
DEVICE
=
"cpu"
DEVICE
=
"cpu"
# DEVICE = "cuda:0"
# DEVICE = "cuda:0"
# Load the Pix2Struct model and processor
# Load the Pix2Struct model and processor
model
=
Pix2StructForConditionalGeneration
.
from_pretrained
(
"google/pix2struct-docvqa-
bas
e"
)
.
to
(
DEVICE
)
model
=
Pix2StructForConditionalGeneration
.
from_pretrained
(
"google/pix2struct-docvqa-
larg
e"
)
.
to
(
DEVICE
)
processor
=
Pix2StructProcessor
.
from_pretrained
(
"google/pix2struct-docvqa-
bas
e"
)
processor
=
Pix2StructProcessor
.
from_pretrained
(
"google/pix2struct-docvqa-
larg
e"
)
def
generate
(
img
,
questions
):
def
generate
(
img
,
questions
):
inputs
=
processor
(
images
=
[
img
for
_
in
range
(
len
(
questions
))],
inputs
=
processor
(
images
=
[
img
for
_
in
range
(
len
(
questions
))],
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment