Innopolis University DevOps Playground
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Follow My Reading
Manage
Activity
Members
Labels
Plan
Issues
6
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Anton Kudryavtsev
Follow My Reading
Commits
f131b989
Unverified
Commit
f131b989
authored
1 year ago
by
Anton Kudryavtsev
Browse files
Options
Downloads
Patches
Plain Diff
feat: extend image plugins
parent
1e189d11
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!21
Feature/extend plugin system image models
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
api/v1/image.py
+2
-2
2 additions, 2 deletions
api/v1/image.py
api/v1/models.py
+18
-0
18 additions, 0 deletions
api/v1/models.py
core/plugins/__init__.py
+8
-1
8 additions, 1 deletion
core/plugins/__init__.py
core/plugins/base.py
+22
-0
22 additions, 0 deletions
core/plugins/base.py
with
50 additions
and
3 deletions
api/v1/image.py
+
2
−
2
View file @
f131b989
...
...
@@ -73,8 +73,8 @@ async def process_image(request: ImageProcessingRequest):
plugin_info
.
class_name
,
ImageProcessingFunction
,
str
(
filepath
)
)
extracted_text
=
await
asyncio
.
get_running_loop
().
run_in_executor
(
model_response
=
await
asyncio
.
get_running_loop
().
run_in_executor
(
None
,
lambda
:
job
.
get
(
blocking
=
True
,
preserve
=
True
)
)
return
ImageProcessingResponse
(
text
=
extracted_text
)
return
ImageProcessingResponse
.
parse_obj
(
model_response
.
dict
()
)
This diff is collapsed.
Click to expand it.
api/v1/models.py
+
18
−
0
View file @
f131b989
...
...
@@ -26,8 +26,26 @@ class ImageProcessingRequest(BaseModel):
image_model
:
str
class
IPRPoint
(
BaseModel
):
x
:
int
y
:
int
class
IPRRectangle
(
BaseModel
):
left_top
:
IPRPoint
right_top
:
IPRPoint
left_bottom
:
IPRPoint
right_bottom
:
IPRPoint
class
IPRTextBox
(
BaseModel
):
text
:
str
coordinates
:
IPRRectangle
class
ImageProcessingResponse
(
BaseModel
):
text
:
str
boxes
:
List
[
IPRTextBox
]
class
AudioProcessingRequest
(
BaseModel
):
...
...
This diff is collapsed.
Click to expand it.
core/plugins/__init__.py
+
8
−
1
View file @
f131b989
...
...
@@ -4,4 +4,11 @@ from core.plugins.loader import (
load_plugins
,
register_plugin
,
)
from
core.plugins.base
import
AudioChunk
,
AudioProcessingResult
from
core.plugins.base
import
(
AudioChunk
,
AudioProcessingResult
,
Point
,
Rectangle
,
ImageTextBox
,
ImageProcessingResult
,
)
This diff is collapsed.
Click to expand it.
core/plugins/base.py
+
22
−
0
View file @
f131b989
...
...
@@ -13,6 +13,28 @@ class AudioProcessingResult(BaseModel):
segments
:
List
[
AudioChunk
]
class
Point
(
BaseModel
):
x
:
int
y
:
int
class
Rectangle
(
BaseModel
):
left_top
:
Point
right_top
:
Point
left_bottom
:
Point
right_bottom
:
Point
class
ImageTextBox
(
BaseModel
):
text
:
str
coordinates
:
Rectangle
class
ImageProcessingResult
(
BaseModel
):
text
:
str
boxes
:
List
[
ImageTextBox
]
@runtime_checkable
class
BasePlugin
(
Protocol
):
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment