Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
d25c4b13
Commit
d25c4b13
authored
Mar 11, 2023
by
Zhang Hua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test/basic_features/{extras,img2img}_test.py: use absolute path
parent
9abe2f5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
test/basic_features/extras_test.py
test/basic_features/extras_test.py
+5
-3
test/basic_features/img2img_test.py
test/basic_features/img2img_test.py
+5
-3
No files found.
test/basic_features/extras_test.py
View file @
d25c4b13
import
os
import
unittest
import
requests
from
gradio.processing_utils
import
encode_pil_to_base64
from
PIL
import
Image
from
modules.paths
import
script_path
class
TestExtrasWorking
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
@@ -19,7 +21,7 @@ class TestExtrasWorking(unittest.TestCase):
"upscaler_1"
:
"None"
,
"upscaler_2"
:
"None"
,
"extras_upscaler_2_visibility"
:
0
,
"image"
:
encode_pil_to_base64
(
Image
.
open
(
r"test/test_files/img2img_basic.png"
))
"image"
:
encode_pil_to_base64
(
Image
.
open
(
os
.
path
.
join
(
script_path
,
r"test/test_files/img2img_basic.png"
)
))
}
def
test_simple_upscaling_performed
(
self
):
...
...
@@ -31,7 +33,7 @@ class TestPngInfoWorking(unittest.TestCase):
def
setUp
(
self
):
self
.
url_png_info
=
"http://localhost:7860/sdapi/v1/extra-single-image"
self
.
png_info
=
{
"image"
:
encode_pil_to_base64
(
Image
.
open
(
r"test/test_files/img2img_basic.png"
))
"image"
:
encode_pil_to_base64
(
Image
.
open
(
os
.
path
.
join
(
script_path
,
r"test/test_files/img2img_basic.png"
)
))
}
def
test_png_info_performed
(
self
):
...
...
@@ -42,7 +44,7 @@ class TestInterrogateWorking(unittest.TestCase):
def
setUp
(
self
):
self
.
url_interrogate
=
"http://localhost:7860/sdapi/v1/extra-single-image"
self
.
interrogate
=
{
"image"
:
encode_pil_to_base64
(
Image
.
open
(
r"test/test_files/img2img_basic.png"
)),
"image"
:
encode_pil_to_base64
(
Image
.
open
(
os
.
path
.
join
(
script_path
,
r"test/test_files/img2img_basic.png"
)
)),
"model"
:
"clip"
}
...
...
test/basic_features/img2img_test.py
View file @
d25c4b13
import
os
import
unittest
import
requests
from
gradio.processing_utils
import
encode_pil_to_base64
from
PIL
import
Image
from
modules.paths
import
script_path
class
TestImg2ImgWorking
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
url_img2img
=
"http://localhost:7860/sdapi/v1/img2img"
self
.
simple_img2img
=
{
"init_images"
:
[
encode_pil_to_base64
(
Image
.
open
(
r"test/test_files/img2img_basic.png"
))],
"init_images"
:
[
encode_pil_to_base64
(
Image
.
open
(
os
.
path
.
join
(
script_path
,
r"test/test_files/img2img_basic.png"
)
))],
"resize_mode"
:
0
,
"denoising_strength"
:
0.75
,
"mask"
:
None
,
...
...
@@ -47,11 +49,11 @@ class TestImg2ImgWorking(unittest.TestCase):
self
.
assertEqual
(
requests
.
post
(
self
.
url_img2img
,
json
=
self
.
simple_img2img
)
.
status_code
,
200
)
def
test_inpainting_masked_performed
(
self
):
self
.
simple_img2img
[
"mask"
]
=
encode_pil_to_base64
(
Image
.
open
(
r"test/test_files/mask_basic.png"
))
self
.
simple_img2img
[
"mask"
]
=
encode_pil_to_base64
(
Image
.
open
(
os
.
path
.
join
(
script_path
,
r"test/test_files/img2img_basic.png"
)
))
self
.
assertEqual
(
requests
.
post
(
self
.
url_img2img
,
json
=
self
.
simple_img2img
)
.
status_code
,
200
)
def
test_inpainting_with_inverted_masked_performed
(
self
):
self
.
simple_img2img
[
"mask"
]
=
encode_pil_to_base64
(
Image
.
open
(
r"test/test_files/mask_basic.png"
))
self
.
simple_img2img
[
"mask"
]
=
encode_pil_to_base64
(
Image
.
open
(
os
.
path
.
join
(
script_path
,
r"test/test_files/img2img_basic.png"
)
))
self
.
simple_img2img
[
"inpainting_mask_invert"
]
=
True
self
.
assertEqual
(
requests
.
post
(
self
.
url_img2img
,
json
=
self
.
simple_img2img
)
.
status_code
,
200
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment