Spaces:
Sleeping
Sleeping
Commit ·
315e367
1
Parent(s): d594335
Update main.py
Browse files
main.py
CHANGED
|
@@ -10,7 +10,7 @@ from stability_sdk import client
|
|
| 10 |
import stability_sdk.interfaces.gooseai.generation.generation_pb2 as generation
|
| 11 |
import replicate
|
| 12 |
|
| 13 |
-
def generate_and_upscale_image(text_prompt, clipdrop_api_key, stability_api_key, replicate_api_token
|
| 14 |
|
| 15 |
headers = {'x-api-key': clipdrop_api_key}
|
| 16 |
body_params = {'prompt': (None, text_prompt, 'text/plain')}
|
|
@@ -68,4 +68,8 @@ def generate_and_upscale_image(text_prompt, clipdrop_api_key, stability_api_key,
|
|
| 68 |
|
| 69 |
response = requests.get(output)
|
| 70 |
final_img = Image.open(io.BytesIO(response.content))
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
import stability_sdk.interfaces.gooseai.generation.generation_pb2 as generation
|
| 11 |
import replicate
|
| 12 |
|
| 13 |
+
def generate_and_upscale_image(text_prompt, clipdrop_api_key, stability_api_key, replicate_api_token):
|
| 14 |
|
| 15 |
headers = {'x-api-key': clipdrop_api_key}
|
| 16 |
body_params = {'prompt': (None, text_prompt, 'text/plain')}
|
|
|
|
| 68 |
|
| 69 |
response = requests.get(output)
|
| 70 |
final_img = Image.open(io.BytesIO(response.content))
|
| 71 |
+
img_byte_arr = io.BytesIO()
|
| 72 |
+
final_img.save(img_byte_arr, format='PNG')
|
| 73 |
+
img_byte_arr = img_byte_arr.getvalue()
|
| 74 |
+
|
| 75 |
+
return img_byte_arr
|