Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
automated_image_processing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hyunseok_Sang
automated_image_processing
Commits
63c56da4
Commit
63c56da4
authored
2 years ago
by
Hyunseok_Sang
Browse files
Options
Downloads
Patches
Plain Diff
dall-E api를 담당하는 클래스 분리
parent
553d58a1
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
back-end2/src/services/api/dallE_api.py
+27
-0
27 additions, 0 deletions
back-end2/src/services/api/dallE_api.py
with
27 additions
and
0 deletions
back-end2/src/services/api/dallE_api.py
0 → 100644
+
27
−
0
View file @
63c56da4
from
config
import
dallE_api_key
import
openai
import
cv2
from
utils.files.file_downloader
import
FileDownloader
from
utils.image.image_writer
import
ImageWriter
class
DallEAPI
():
def
outpainting
(
self
,
np_image
,
length
=
1024
)
->
'
numpy.ndarray
'
:
openai
.
api_key
=
dallE_api_key
np_image
=
cv2
.
resize
(
np_image
,
(
length
,
length
))
cv2
.
imwrite
(
"
outpainting_temp.png
"
,
np_image
)
outpainted
=
openai
.
Image
.
create_edit
(
image
=
open
(
"
outpainting_temp.png
"
,
"
rb
"
),
prompt
=
"
photo of person
"
,
n
=
1
,
size
=
str
(
length
)
+
"
x
"
+
str
(
length
)
)
image_url
=
outpainted
.
data
[
0
][
'
url
'
]
dallE_image_path
=
FileDownloader
().
download_image
(
image_url
,
file_name
=
"
dallE.png
"
)
dallE_np_image
=
cv2
.
imread
(
dallE_image_path
)
return
dallE_np_image
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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