Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
H
Hydra Node Http
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
Hydra Node Http
Commits
5a7f99ce
Commit
5a7f99ce
authored
Aug 24, 2022
by
kurumuz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix fo real
parent
a7c83659
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
client.py
client.py
+27
-0
hydra_node/sanitize.py
hydra_node/sanitize.py
+3
-3
No files found.
client.py
0 → 100644
View file @
5a7f99ce
import
requests
import
json
#server hosts on 0.0.0.0
IP_ADDR
=
'0.0.0.0'
PORT
=
'4315'
payload
=
{
'prompt'
:
'Hello World'
,
"width"
:
512
,
"height"
:
512
,
"scale"
:
12
,
"sampler"
:
"k_lms"
,
"steps"
:
50
,
"seed"
:
3808250753
,
"n_samples"
:
1
,
"strength"
:
0.7
,
"noise"
:
0.6
,
"masks"
:
[
{
"seed"
:
2023444088
,
"mask"
:
"iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAKtJREFUeF7t2LENxDAMA0Br/6GVCf4rNQQvAxiBYPEIz+7uK/7GANwAKyADijPwCUEKUIACFKBA8QR+MjgzryEf9QA9oOGe/8k4K2AFrIAqrAoXF0EPIhjEIAYxiEEMFk8AgxjEIAZjGbx4uY4OwfoBXOgdfQMM4GACboAipAgpQrFF6CADvQpTgAIUoAAFLjhJPYMCFKAABSiQmuAX/00BClCAAhS4SNPUMz4jPAhQiCYcNQAAAABJRU5ErkJggg=="
}
]
}
response
=
requests
.
post
(
'http://'
+
IP_ADDR
+
':'
+
PORT
+
'/generate-stream'
,
json
=
payload
)
print
(
response
.
text
)
\ No newline at end of file
hydra_node/sanitize.py
View file @
5a7f99ce
...
...
@@ -140,7 +140,7 @@ def sanitize_stable_diffusion(request, config):
for
x
in
range
(
len
(
masks
)):
image
=
masks
[
x
][
"mask"
]
try
:
image
=
base64
.
b64decode
(
image
.
encode
(
'utf-8'
))
image
_bytes
=
base64
.
b64decode
(
image
.
encode
(
'utf-8'
))
except
Exception
as
e
:
traceback
.
print_exc
()
...
...
@@ -148,7 +148,7 @@ def sanitize_stable_diffusion(request, config):
try
:
from
PIL
import
Image
image
=
Image
.
open
(
BytesIO
(
image
))
image
=
Image
.
open
(
BytesIO
(
image
_bytes
))
image
.
verify
()
except
Exception
as
e
:
...
...
@@ -157,7 +157,7 @@ def sanitize_stable_diffusion(request, config):
#image is valid, load it again(still check again, verify() can't be sure as it doesn't decode.)
try
:
#image = Image.open(BytesIO(image
))
image
=
Image
.
open
(
BytesIO
(
image_bytes
))
#image = image.convert('RGB')
image
=
image
.
resize
((
request
.
width
//
request
.
downsampling_factor
,
request
.
height
//
request
.
downsampling_factor
),
resample
=
Image
.
Resampling
.
LANCZOS
)
...
...
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