Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,8 +51,8 @@ def upscale_image(contents):
|
|
| 51 |
# App layout
|
| 52 |
app.layout = dbc.Container([
|
| 53 |
html.H1("Image Upscaler", className="text-center my-4"),
|
| 54 |
-
dbc.
|
| 55 |
-
dbc.
|
| 56 |
dcc.Upload(
|
| 57 |
id='upload-image',
|
| 58 |
children=html.Div([
|
|
@@ -71,13 +71,21 @@ app.layout = dbc.Container([
|
|
| 71 |
},
|
| 72 |
multiple=False
|
| 73 |
),
|
| 74 |
-
html.Div(id='output-image-upload'),
|
| 75 |
dbc.Button("Upscale Image", id="upscale-button", color="primary", className="mt-3"),
|
| 76 |
-
html.Div(id='upscaling-status'),
|
| 77 |
-
html.Div(id='output-upscaled-image'),
|
| 78 |
dbc.Button("Download Upscaled Image", id="download-button", color="success", className="mt-3", disabled=True),
|
| 79 |
dcc.Download(id="download-image")
|
| 80 |
-
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
]),
|
| 82 |
], fluid=True)
|
| 83 |
|
|
@@ -90,7 +98,6 @@ def update_output(contents, filename):
|
|
| 90 |
if contents is not None:
|
| 91 |
return dbc.Card([
|
| 92 |
dbc.CardBody([
|
| 93 |
-
html.H4("Uploaded Image"),
|
| 94 |
html.Img(src=contents, style={'width': '100%'}),
|
| 95 |
html.P(filename)
|
| 96 |
])
|
|
@@ -127,12 +134,9 @@ def upscale_image_callback(n_clicks, contents):
|
|
| 127 |
time.sleep(0.1) # Wait for the upscaling to complete
|
| 128 |
|
| 129 |
if generated_file:
|
| 130 |
-
upscaled_image =
|
| 131 |
-
dbc.
|
| 132 |
-
|
| 133 |
-
html.H4("Upscaled Image"),
|
| 134 |
-
html.Img(src=f"data:image/png;base64,{base64.b64encode(generated_file).decode()}", style={'width': '100%'})
|
| 135 |
-
])
|
| 136 |
])
|
| 137 |
])
|
| 138 |
return status_div, upscaled_image, False
|
|
|
|
| 51 |
# App layout
|
| 52 |
app.layout = dbc.Container([
|
| 53 |
html.H1("Image Upscaler", className="text-center my-4"),
|
| 54 |
+
dbc.Row([
|
| 55 |
+
dbc.Col([
|
| 56 |
dcc.Upload(
|
| 57 |
id='upload-image',
|
| 58 |
children=html.Div([
|
|
|
|
| 71 |
},
|
| 72 |
multiple=False
|
| 73 |
),
|
|
|
|
| 74 |
dbc.Button("Upscale Image", id="upscale-button", color="primary", className="mt-3"),
|
| 75 |
+
html.Div(id='upscaling-status', className="mt-3"),
|
|
|
|
| 76 |
dbc.Button("Download Upscaled Image", id="download-button", color="success", className="mt-3", disabled=True),
|
| 77 |
dcc.Download(id="download-image")
|
| 78 |
+
], md=12, lg=6),
|
| 79 |
+
]),
|
| 80 |
+
dbc.Row([
|
| 81 |
+
dbc.Col([
|
| 82 |
+
html.H4("Original Image", className="mt-4"),
|
| 83 |
+
html.Div(id='output-image-upload')
|
| 84 |
+
], md=12, lg=6),
|
| 85 |
+
dbc.Col([
|
| 86 |
+
html.H4("Upscaled Image", className="mt-4"),
|
| 87 |
+
html.Div(id='output-upscaled-image')
|
| 88 |
+
], md=12, lg=6),
|
| 89 |
]),
|
| 90 |
], fluid=True)
|
| 91 |
|
|
|
|
| 98 |
if contents is not None:
|
| 99 |
return dbc.Card([
|
| 100 |
dbc.CardBody([
|
|
|
|
| 101 |
html.Img(src=contents, style={'width': '100%'}),
|
| 102 |
html.P(filename)
|
| 103 |
])
|
|
|
|
| 134 |
time.sleep(0.1) # Wait for the upscaling to complete
|
| 135 |
|
| 136 |
if generated_file:
|
| 137 |
+
upscaled_image = dbc.Card([
|
| 138 |
+
dbc.CardBody([
|
| 139 |
+
html.Img(src=f"data:image/png;base64,{base64.b64encode(generated_file).decode()}", style={'width': '100%'})
|
|
|
|
|
|
|
|
|
|
| 140 |
])
|
| 141 |
])
|
| 142 |
return status_div, upscaled_image, False
|