Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,21 +2,6 @@ import gradio as gr
|
|
2 |
from PIL import Image
|
3 |
import os
|
4 |
|
5 |
-
# Copyright 2025 Flowly AI. All rights reserved.
|
6 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7 |
-
# you may not use this file except in compliance with the License.
|
8 |
-
# You may obtain a copy of the License at
|
9 |
-
#
|
10 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11 |
-
#
|
12 |
-
# Unless required by applicable law or agreed to in writing, software
|
13 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 |
-
# See the License for the specific language governing permissions and
|
16 |
-
# limitations under the License.
|
17 |
-
#
|
18 |
-
# AI Project by Flowly AI, Created by: Aditya Dwi Nugraha
|
19 |
-
|
20 |
# Ambil daftar format gambar yang didukung oleh Pillow
|
21 |
supported_formats = sorted(Image.SAVE.keys())
|
22 |
|
@@ -38,18 +23,18 @@ def convert_image(image, target_format):
|
|
38 |
except Exception as e:
|
39 |
return f"Error: {e}"
|
40 |
|
41 |
-
# Antarmuka Gradio
|
42 |
interface = gr.Interface(
|
43 |
fn=convert_image,
|
44 |
inputs=[
|
45 |
-
gr.Image(label="Upload Image", type="filepath", height=
|
46 |
gr.Dropdown(label="Select Target Format", choices=supported_formats)
|
47 |
],
|
48 |
outputs=gr.File(label="Converted Image"),
|
49 |
title="Universal Image Format Converter",
|
50 |
-
description=""
|
51 |
-
|
52 |
-
|
53 |
)
|
54 |
|
55 |
# Jalankan aplikasi
|
|
|
2 |
from PIL import Image
|
3 |
import os
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
# Ambil daftar format gambar yang didukung oleh Pillow
|
6 |
supported_formats = sorted(Image.SAVE.keys())
|
7 |
|
|
|
23 |
except Exception as e:
|
24 |
return f"Error: {e}"
|
25 |
|
26 |
+
# Antarmuka Gradio dengan tema tanpa footer
|
27 |
interface = gr.Interface(
|
28 |
fn=convert_image,
|
29 |
inputs=[
|
30 |
+
gr.Image(label="Upload Image", type="filepath", height=256), # Atur tinggi gambar input
|
31 |
gr.Dropdown(label="Select Target Format", choices=supported_formats)
|
32 |
],
|
33 |
outputs=gr.File(label="Converted Image"),
|
34 |
title="Universal Image Format Converter",
|
35 |
+
description="Upload an image and select any target format for conversion. Supports all formats recognized by Pillow.",
|
36 |
+
live=True,
|
37 |
+
theme=gr.themes.Base() # Tema yang menghilangkan footer
|
38 |
)
|
39 |
|
40 |
# Jalankan aplikasi
|