Spaces:
Build error
Build error
Update app.py
Browse filesUsing gr.Files for file inputs
app.py
CHANGED
@@ -60,11 +60,12 @@ def resize_image(input_image, width, height):
|
|
60 |
temp_file.close()
|
61 |
return Image.open(temp_file.name)
|
62 |
|
63 |
-
def process_images(
|
64 |
processed_images = []
|
65 |
file_paths = []
|
66 |
|
67 |
-
for
|
|
|
68 |
original_image = Image.fromarray(input_image.astype('uint8'), 'RGB')
|
69 |
|
70 |
if enhance:
|
@@ -86,7 +87,7 @@ def process_images(input_images, enhance, scale, adjust_dpi, dpi, resize, width,
|
|
86 |
iface = gr.Interface(
|
87 |
fn=process_images,
|
88 |
inputs=[
|
89 |
-
gr.
|
90 |
gr.Checkbox(label="Enhance Images (ESRGAN)"),
|
91 |
gr.Radio(['2x', '4x', '8x'], type="value", value='2x', label='Resolution model'),
|
92 |
gr.Checkbox(label="Adjust DPI"),
|
|
|
60 |
temp_file.close()
|
61 |
return Image.open(temp_file.name)
|
62 |
|
63 |
+
def process_images(image_files, enhance, scale, adjust_dpi, dpi, resize, width, height):
|
64 |
processed_images = []
|
65 |
file_paths = []
|
66 |
|
67 |
+
for image_file in image_files:
|
68 |
+
input_image = np.array(Image.open(image_file).convert('RGB'))
|
69 |
original_image = Image.fromarray(input_image.astype('uint8'), 'RGB')
|
70 |
|
71 |
if enhance:
|
|
|
87 |
iface = gr.Interface(
|
88 |
fn=process_images,
|
89 |
inputs=[
|
90 |
+
gr.Files(label="Upload Image Files"), # Use gr.Files for multiple file uploads
|
91 |
gr.Checkbox(label="Enhance Images (ESRGAN)"),
|
92 |
gr.Radio(['2x', '4x', '8x'], type="value", value='2x', label='Resolution model'),
|
93 |
gr.Checkbox(label="Adjust DPI"),
|