Update app.py
Browse files
app.py
CHANGED
|
@@ -43,12 +43,17 @@ function createGradioAnimation() {
|
|
| 43 |
image = Image.open('background3.png')
|
| 44 |
|
| 45 |
#Calculate the new dimensions while maintaining the aspect ratio
|
| 46 |
-
|
|
|
|
| 47 |
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
with gr.Blocks(js=js,theme=gr.themes.Soft()) as demo:
|
| 51 |
-
gr.Image(background, height =
|
| 52 |
gr.Markdown(
|
| 53 |
'''
|
| 54 |
Eye disease can lead to vision impairment and complete blindness that affect one's ability in daily life.
|
|
|
|
| 43 |
image = Image.open('background3.png')
|
| 44 |
|
| 45 |
#Calculate the new dimensions while maintaining the aspect ratio
|
| 46 |
+
new_height = 200
|
| 47 |
+
new_width = int((new_height / image.height) * image.width)
|
| 48 |
|
| 49 |
+
#Resize the image
|
| 50 |
+
resized_iamge = image.resize((new_width, new_height), Image.LANCZOS)
|
| 51 |
+
|
| 52 |
+
#Pad the image to maintain the original width
|
| 53 |
+
background = ImageOps.pad(resized_iamge, (image.width, new_height), method=Image.LANCZOS, color=(255,255,255))
|
| 54 |
|
| 55 |
with gr.Blocks(js=js,theme=gr.themes.Soft()) as demo:
|
| 56 |
+
gr.Image(background, height = new_height, width = image.width, interactive = False, show_download_button = False, show_share_button = False)
|
| 57 |
gr.Markdown(
|
| 58 |
'''
|
| 59 |
Eye disease can lead to vision impairment and complete blindness that affect one's ability in daily life.
|