Spaces:
Running
Running
update bug
Browse files
caller.py
CHANGED
|
@@ -70,11 +70,11 @@ class SeedT2ICaller():
|
|
| 70 |
response = requests.post(
|
| 71 |
t2i_url,
|
| 72 |
headers=headers,
|
| 73 |
-
data={
|
| 74 |
'AlgoType': 1,
|
| 75 |
'ReqJson': req_json,
|
| 76 |
'AuthInfo': authInfo
|
| 77 |
-
}
|
| 78 |
)
|
| 79 |
logger.info(f"header: {response.headers}")
|
| 80 |
if response.status_code != 200:
|
|
@@ -88,7 +88,6 @@ class SeedT2ICaller():
|
|
| 88 |
binary_data = binary_data1[0]
|
| 89 |
#logger.info(f"binary_data: {binary_data}")
|
| 90 |
image = Image.open(io.BytesIO(base64.b64decode(binary_data)))
|
| 91 |
-
#image.save('./t2i_image.png')
|
| 92 |
image = image.resize((self.cfg['resolution'], self.cfg['resolution']))
|
| 93 |
return image, True
|
| 94 |
|
|
@@ -147,10 +146,6 @@ if __name__ == "__main__":
|
|
| 147 |
"resolution": 611
|
| 148 |
}
|
| 149 |
model_t2i = SeedT2ICaller(cfg_t2i)
|
| 150 |
-
model_t2i.generate("a beautiful girl")
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
with open(image_path, 'rb') as image:
|
| 154 |
-
image_bytes = image.read()
|
| 155 |
-
model_edit = SeedEditCaller(cfg_t2i)
|
| 156 |
-
model_edit.edit(image=image_bytes,edit="please edit to a good man")
|
|
|
|
| 70 |
response = requests.post(
|
| 71 |
t2i_url,
|
| 72 |
headers=headers,
|
| 73 |
+
data=json.dumps({
|
| 74 |
'AlgoType': 1,
|
| 75 |
'ReqJson': req_json,
|
| 76 |
'AuthInfo': authInfo
|
| 77 |
+
})
|
| 78 |
)
|
| 79 |
logger.info(f"header: {response.headers}")
|
| 80 |
if response.status_code != 200:
|
|
|
|
| 88 |
binary_data = binary_data1[0]
|
| 89 |
#logger.info(f"binary_data: {binary_data}")
|
| 90 |
image = Image.open(io.BytesIO(base64.b64decode(binary_data)))
|
|
|
|
| 91 |
image = image.resize((self.cfg['resolution'], self.cfg['resolution']))
|
| 92 |
return image, True
|
| 93 |
|
|
|
|
| 146 |
"resolution": 611
|
| 147 |
}
|
| 148 |
model_t2i = SeedT2ICaller(cfg_t2i)
|
| 149 |
+
image, _ = model_t2i.generate("a beautiful girl")
|
| 150 |
+
model_edit = SeedEditCaller(cfg_t2i)
|
| 151 |
+
model_edit.edit(image, edit="please edit to a good man")
|
|
|
|
|
|
|
|
|
|
|
|