analist commited on
Commit
6dd0277
1 Parent(s): 485af7c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -5,13 +5,14 @@ from PIL import Image
5
  st.title('Take your picture to the next level')
6
 
7
  col1, col2 = st.columns([3, 1])
 
8
 
9
  with col1:
10
  file = st.file_uploader('Post your picture')
11
  if file is not None:
12
  image = Image.open(file)
13
  st.image(image)
14
-
15
  with col2:
16
  choice = st.selectbox('Scale to', ['x2', 'x3', 'x4'])
17
  model_choice = st.selectbox('Model', ['EDSR', 'PAN', 'CARN'])
@@ -19,10 +20,13 @@ with col2:
19
  st.text(choice)
20
 
21
 
22
- """
23
- model = EdsrModel.from_pretrained('eugenesiow/edsr-base', scale=2)
 
 
 
24
  inputs = ImageLoader.load_image(image)
25
  preds = model(inputs)
26
 
27
- ImageLoader.save_image(preds, './scaled_2x.png')
28
- ImageLoader.save_compare(inputs, preds, './scaled_2x_compare.png')"""
 
5
  st.title('Take your picture to the next level')
6
 
7
  col1, col2 = st.columns([3, 1])
8
+ preds = None
9
 
10
  with col1:
11
  file = st.file_uploader('Post your picture')
12
  if file is not None:
13
  image = Image.open(file)
14
  st.image(image)
15
+
16
  with col2:
17
  choice = st.selectbox('Scale to', ['x2', 'x3', 'x4'])
18
  model_choice = st.selectbox('Model', ['EDSR', 'PAN', 'CARN'])
 
20
  st.text(choice)
21
 
22
 
23
+ if model_choice == "EDSR":
24
+ model = EdsrModel.from_pretrained('eugenesiow/edsr-base', scale=choice)
25
+ else:
26
+ st.text('Not supported yet. Comeback soon for fun releases')
27
+
28
  inputs = ImageLoader.load_image(image)
29
  preds = model(inputs)
30
 
31
+ st.subheader('New image')
32
+ st.image(preds, cpation=f'Upscaled {choice} times image')