bluenevus commited on
Commit
6904ba7
·
verified ·
1 Parent(s): 4441bea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -14
app.py CHANGED
@@ -73,18 +73,18 @@ app.layout = dbc.Container([
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)
@@ -96,11 +96,9 @@ app.layout = dbc.Container([
96
  )
97
  def update_output(contents, filename):
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
- ])
104
  ])
105
 
106
  @app.callback(
@@ -117,7 +115,7 @@ def upscale_image_callback(n_clicks, contents):
117
 
118
  status_div = html.Div([
119
  html.P("Upscaling image... ", style={'display': 'inline'}),
120
- html.Div(className="dot-flashing")
121
  ])
122
 
123
  def upscale_thread():
@@ -134,10 +132,8 @@ def upscale_image_callback(n_clicks, contents):
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
143
  else:
 
73
  ),
74
  dbc.Button("Upscale Image", id="upscale-button", color="primary", className="mt-3"),
75
  html.Div(id='upscaling-status', className="mt-3"),
 
 
76
  ], md=12, lg=6),
77
  ]),
78
  dbc.Row([
79
  dbc.Col([
80
  html.H4("Original Image", className="mt-4"),
81
+ dbc.Card(id='output-image-upload', body=True)
82
  ], md=12, lg=6),
83
  dbc.Col([
84
  html.H4("Upscaled Image", className="mt-4"),
85
+ dbc.Card(id='output-upscaled-image', body=True),
86
+ dbc.Button("Download Upscaled Image", id="download-button", color="success", className="mt-3", disabled=True),
87
+ dcc.Download(id="download-image")
88
  ], md=12, lg=6),
89
  ]),
90
  ], fluid=True)
 
96
  )
97
  def update_output(contents, filename):
98
  if contents is not None:
99
+ return html.Div([
100
+ html.Img(src=contents, style={'width': '100%'}),
101
+ html.P(filename)
 
 
102
  ])
103
 
104
  @app.callback(
 
115
 
116
  status_div = html.Div([
117
  html.P("Upscaling image... ", style={'display': 'inline'}),
118
+ html.Div(className="pulsing-dot")
119
  ])
120
 
121
  def upscale_thread():
 
132
  time.sleep(0.1) # Wait for the upscaling to complete
133
 
134
  if generated_file:
135
+ upscaled_image = html.Div([
136
+ html.Img(src=f"data:image/png;base64,{base64.b64encode(generated_file).decode()}", style={'width': '100%'})
 
 
137
  ])
138
  return status_div, upscaled_image, False
139
  else: