done
Browse files
app.py
CHANGED
@@ -20,11 +20,11 @@ upscale_class=Upscale_CaseCade()
|
|
20 |
# url = "https://cdn.discordapp.com/attachments/1121232062708457508/1205110687538479145/A_photograph_of_a_sunflower_with_sunglasses_on_in__3.jpg?ex=65d72dc9&is=65c4b8c9&hm=72172e774ce6cda618503b3778b844de05cd1208b61e185d8418db512fb2858a&"
|
21 |
# image_pil=Image.open("/home/rnd/Documents/Ameer/StableCascade/poster.png").convert("RGB")
|
22 |
@spaces.GPU
|
23 |
-
def scale_image(image_pil,scale_factor):
|
24 |
-
|
25 |
current_date_time = datetime.datetime.now()
|
26 |
print("Current Date and Time:", current_date_time)
|
27 |
-
return [
|
28 |
DESCRIPTION = "# Stable Cascade -> Super Resolution"
|
29 |
DESCRIPTION += "\n<p style=\"text-align: center\">Unofficial demo for Cascade-Super Resolution <a href='https://huggingface.co/stabilityai/stable-cascade' target='_blank'>Stable Upscale Cascade</a>, a new high resolution image-to-image model by Stability AI, - <a href='https://huggingface.co/stabilityai/stable-cascade/blob/main/LICENSE' target='_blank'>non-commercial research license</a></p>"
|
30 |
# block = gr.Blocks(css="footer {visibility: hidden}", theme='freddyaboulton/dracula_revamped').queue()
|
@@ -36,14 +36,14 @@ with block:
|
|
36 |
with gr.Tabs():
|
37 |
with gr.Row():
|
38 |
with gr.Column():
|
|
|
39 |
image_pil = gr.Image(label="Describe the Image", type='pil')
|
40 |
scale_factor = gr.Slider(minimum=1,maximum=10,value=1, step=1, label="Scale Factor")
|
41 |
generate_button = gr.Button("Upscale Image")
|
42 |
with gr.Column():
|
43 |
generated_image = gr.Gallery(label="Generated Image",)
|
44 |
|
45 |
-
generate_button.click(fn=scale_image, inputs=[image_pil,scale_factor], outputs=[generated_image])
|
46 |
|
47 |
block.queue(max_size=20).launch()
|
48 |
-
|
49 |
# pip install gradio==4.16.0 gradio_client==0.8.1
|
|
|
20 |
# url = "https://cdn.discordapp.com/attachments/1121232062708457508/1205110687538479145/A_photograph_of_a_sunflower_with_sunglasses_on_in__3.jpg?ex=65d72dc9&is=65c4b8c9&hm=72172e774ce6cda618503b3778b844de05cd1208b61e185d8418db512fb2858a&"
|
21 |
# image_pil=Image.open("/home/rnd/Documents/Ameer/StableCascade/poster.png").convert("RGB")
|
22 |
@spaces.GPU
|
23 |
+
def scale_image(caption,image_pil,scale_factor):
|
24 |
+
upscale=upscale_class.upscale_image(caption=caption,image_pil=image_pil.convert("RGB"),scale_fator=scale_factor)
|
25 |
current_date_time = datetime.datetime.now()
|
26 |
print("Current Date and Time:", current_date_time)
|
27 |
+
return [upscale]
|
28 |
DESCRIPTION = "# Stable Cascade -> Super Resolution"
|
29 |
DESCRIPTION += "\n<p style=\"text-align: center\">Unofficial demo for Cascade-Super Resolution <a href='https://huggingface.co/stabilityai/stable-cascade' target='_blank'>Stable Upscale Cascade</a>, a new high resolution image-to-image model by Stability AI, - <a href='https://huggingface.co/stabilityai/stable-cascade/blob/main/LICENSE' target='_blank'>non-commercial research license</a></p>"
|
30 |
# block = gr.Blocks(css="footer {visibility: hidden}", theme='freddyaboulton/dracula_revamped').queue()
|
|
|
36 |
with gr.Tabs():
|
37 |
with gr.Row():
|
38 |
with gr.Column():
|
39 |
+
caption = gr.Textbox(label="caption")
|
40 |
image_pil = gr.Image(label="Describe the Image", type='pil')
|
41 |
scale_factor = gr.Slider(minimum=1,maximum=10,value=1, step=1, label="Scale Factor")
|
42 |
generate_button = gr.Button("Upscale Image")
|
43 |
with gr.Column():
|
44 |
generated_image = gr.Gallery(label="Generated Image",)
|
45 |
|
46 |
+
generate_button.click(fn=scale_image, inputs=[caption,image_pil,scale_factor], outputs=[generated_image])
|
47 |
|
48 |
block.queue(max_size=20).launch()
|
|
|
49 |
# pip install gradio==4.16.0 gradio_client==0.8.1
|