Spaces:
Running
Running
Commit
·
59daf6e
1
Parent(s):
02b03a5
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,8 +5,10 @@ import PIL.Image
|
|
| 5 |
from io import BytesIO
|
| 6 |
import os
|
| 7 |
import random
|
|
|
|
| 8 |
|
| 9 |
def generate_image(prompt, negative_prompt, scheduler, steps, width, height, restore_faces, seed, cfg):
|
|
|
|
| 10 |
restore_faces = bool(restore_faces)
|
| 11 |
print(f"restore_faces: {restore_faces}, type: {type(restore_faces)}")
|
| 12 |
# Define the API endpoint
|
|
@@ -65,6 +67,14 @@ def generate_image(prompt, negative_prompt, scheduler, steps, width, height, res
|
|
| 65 |
image_response = requests.get(image_url)
|
| 66 |
image = PIL.Image.open(BytesIO(image_response.content))
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
return image
|
| 69 |
else:
|
| 70 |
raise Exception("Unexpected API response format")
|
|
|
|
| 5 |
from io import BytesIO
|
| 6 |
import os
|
| 7 |
import random
|
| 8 |
+
import datetime
|
| 9 |
|
| 10 |
def generate_image(prompt, negative_prompt, scheduler, steps, width, height, restore_faces, seed, cfg):
|
| 11 |
+
request_time = datetime.datetime.now()
|
| 12 |
restore_faces = bool(restore_faces)
|
| 13 |
print(f"restore_faces: {restore_faces}, type: {type(restore_faces)}")
|
| 14 |
# Define the API endpoint
|
|
|
|
| 67 |
image_response = requests.get(image_url)
|
| 68 |
image = PIL.Image.open(BytesIO(image_response.content))
|
| 69 |
|
| 70 |
+
# Log the information together
|
| 71 |
+
print(f"Request time: {request_time}\n"
|
| 72 |
+
f"Prompt: {prompt}\n"
|
| 73 |
+
f"Negative Prompt: {negative_prompt}\n"
|
| 74 |
+
f"Seed: {seed}\n"
|
| 75 |
+
f"Res(width x height): {width} x {height}\n"
|
| 76 |
+
f"Image URL: {image_url}")
|
| 77 |
+
|
| 78 |
return image
|
| 79 |
else:
|
| 80 |
raise Exception("Unexpected API response format")
|