Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -38,6 +38,20 @@ def style_transfer(input_image_path, style_image_path, revised_prompt):
|
|
38 |
)
|
39 |
return output[0]
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
|
43 |
def infer(text,title):
|
@@ -46,10 +60,12 @@ def infer(text,title):
|
|
46 |
Please make sure not to include text in the image."""
|
47 |
image_url_openai, revised_prompt = generate_image_openai(prompt)
|
48 |
style_image_url = style_transfer(image_url_openai, f'./Style.png',revised_prompt)
|
|
|
49 |
|
50 |
response_dalle = requests.get(image_url_openai)
|
51 |
dalle_img = Image.open(BytesIO(response_dalle.content))
|
52 |
-
|
|
|
53 |
img = Image.open(BytesIO(response.content))
|
54 |
|
55 |
return dalle_img, img
|
|
|
38 |
)
|
39 |
return output[0]
|
40 |
|
41 |
+
def upscale_image(image_path):
|
42 |
+
input = {
|
43 |
+
"image": image_path,
|
44 |
+
"prompt": "candid photo, high iso, phone camera, grainy <lora:more_details:0.5> , symmetric hands" ,
|
45 |
+
"scale_factor": 2,
|
46 |
+
|
47 |
+
}
|
48 |
+
output = replicate.run(
|
49 |
+
"philz1337x/clarity-upscaler:eba39f520856d5e61a8ad56fd57f97be2fa30de65e29d8e94db5209a1827cd59",
|
50 |
+
input=input)
|
51 |
+
|
52 |
+
return output[0]
|
53 |
+
|
54 |
+
|
55 |
|
56 |
|
57 |
def infer(text,title):
|
|
|
60 |
Please make sure not to include text in the image."""
|
61 |
image_url_openai, revised_prompt = generate_image_openai(prompt)
|
62 |
style_image_url = style_transfer(image_url_openai, f'./Style.png',revised_prompt)
|
63 |
+
upscaled_image_url = upscale_image(style_image_url)
|
64 |
|
65 |
response_dalle = requests.get(image_url_openai)
|
66 |
dalle_img = Image.open(BytesIO(response_dalle.content))
|
67 |
+
|
68 |
+
response = requests.get(upscaled_image_url)
|
69 |
img = Image.open(BytesIO(response.content))
|
70 |
|
71 |
return dalle_img, img
|