Spaces:
Sleeping
Sleeping
alifuatkurt
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -144,26 +144,13 @@ def apply_filter(filter_type, input_image=None):
|
|
144 |
elif filter_type == "Grayscale":
|
145 |
return apply_grayscale_filter(frame)
|
146 |
|
147 |
-
|
148 |
-
|
|
|
149 |
|
150 |
-
|
151 |
-
|
152 |
-
choices=["Retro", "Grayscale", "Cartoon", "Oil Painting", "Emboss", "Brightness & Contrast",
|
153 |
-
"Pencil Drawing", "Pastel", "HDR", "Summer", "Winter", "Glass Shatter", "Glitch" ],
|
154 |
-
value="Retro"
|
155 |
-
)
|
156 |
-
|
157 |
-
input_image = gr.Image(label="Resim Yükle", type="numpy")
|
158 |
-
output_image = gr.Image(label="Filtre Uygulandı")
|
159 |
-
|
160 |
-
apply_button = gr.Button("Filtreyi Uygula")
|
161 |
-
apply_button.click(fn=apply_filter, inputs=[filter_type, input_image], outputs=output_image)
|
162 |
-
|
163 |
-
|
164 |
-
with gr.Blocks(css="""
|
165 |
.main { background-color: #1f1f1f; }
|
166 |
-
.block { background-color: #1f1f1f; }
|
167 |
.gradio-container { background-color: #1f1f1f; }
|
168 |
.custom-button {
|
169 |
background-color: #00163a;
|
@@ -178,44 +165,46 @@ with gr.Blocks(css="""
|
|
178 |
background-color: #001c4d;
|
179 |
}
|
180 |
#header {
|
181 |
-
text-align: center;
|
182 |
-
color: #ffffff;
|
183 |
}
|
184 |
body {
|
185 |
-
background-color: #000f26;
|
186 |
}
|
187 |
-
#input-image {
|
188 |
-
background-color: #000f26;
|
189 |
-
padding: 20px;
|
190 |
-
border-radius: 10px;
|
191 |
-
}
|
192 |
-
#output-image {
|
193 |
-
background-color: #000f26; /* Koyu mavi arka plan rengi */
|
194 |
padding: 20px;
|
195 |
border-radius: 10px;
|
196 |
}
|
197 |
#filter-dropdown {
|
198 |
-
background-color: #
|
199 |
-
color:
|
200 |
-
border:
|
201 |
padding: 10px;
|
202 |
border-radius: 10px;
|
|
|
|
|
203 |
}
|
204 |
""") as demo:
|
205 |
gr.Markdown("<h1 id='header'>Görüntü Filtreleri Uygulaması</h1>")
|
206 |
-
|
207 |
filter_type = gr.Dropdown(
|
208 |
label="Filtre Seçin",
|
209 |
choices=["Retro", "Grayscale", "Cartoon", "Oil Painting", "Emboss", "Brightness & Contrast",
|
210 |
-
"Pencil Drawing","Pastel", "HDR", "Summer", "Winter", "Glass Shatter", "Glitch"],
|
211 |
value="Retro",
|
212 |
elem_id="filter-dropdown"
|
213 |
)
|
214 |
|
215 |
-
|
216 |
-
|
|
|
|
|
|
|
|
|
|
|
217 |
|
218 |
-
apply_button = gr.Button("Filtreyi Uygula", elem_id="apply-button", elem_classes="custom-button")
|
219 |
apply_button.click(fn=apply_filter, inputs=[filter_type, input_image], outputs=output_image)
|
|
|
220 |
|
221 |
demo.launch()
|
|
|
144 |
elif filter_type == "Grayscale":
|
145 |
return apply_grayscale_filter(frame)
|
146 |
|
147 |
+
def reset_images():
|
148 |
+
"""Yüklenen ve filtreli görüntüleri temizlemek için kullanılır."""
|
149 |
+
return None, None
|
150 |
|
151 |
+
# Gradio arayüz tanımlamaları
|
152 |
+
with gr.Blocks(css="""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
.main { background-color: #1f1f1f; }
|
|
|
154 |
.gradio-container { background-color: #1f1f1f; }
|
155 |
.custom-button {
|
156 |
background-color: #00163a;
|
|
|
165 |
background-color: #001c4d;
|
166 |
}
|
167 |
#header {
|
168 |
+
text-align: center;
|
169 |
+
color: #ffffff;
|
170 |
}
|
171 |
body {
|
172 |
+
background-color: #000f26;
|
173 |
}
|
174 |
+
#input-image, #output-image {
|
175 |
+
background-color: #000f26;
|
|
|
|
|
|
|
|
|
|
|
176 |
padding: 20px;
|
177 |
border-radius: 10px;
|
178 |
}
|
179 |
#filter-dropdown {
|
180 |
+
background-color: #00163a; /* Burada arka plan rengini değiştirdik */
|
181 |
+
color: #00ccff;
|
182 |
+
border: 2px solid #00ccff;
|
183 |
padding: 10px;
|
184 |
border-radius: 10px;
|
185 |
+
font-size: 16px;
|
186 |
+
text-align: center;
|
187 |
}
|
188 |
""") as demo:
|
189 |
gr.Markdown("<h1 id='header'>Görüntü Filtreleri Uygulaması</h1>")
|
190 |
+
|
191 |
filter_type = gr.Dropdown(
|
192 |
label="Filtre Seçin",
|
193 |
choices=["Retro", "Grayscale", "Cartoon", "Oil Painting", "Emboss", "Brightness & Contrast",
|
194 |
+
"Pencil Drawing", "Pastel", "HDR", "Summer", "Winter", "Glass Shatter", "Glitch"],
|
195 |
value="Retro",
|
196 |
elem_id="filter-dropdown"
|
197 |
)
|
198 |
|
199 |
+
with gr.Row():
|
200 |
+
input_image = gr.Image(label="Resim Yükle", type="numpy", elem_id="input-image", width=300, height=300)
|
201 |
+
output_image = gr.Image(label="Filtre Uygulandı", elem_id="output-image", width=300, height=300)
|
202 |
+
|
203 |
+
with gr.Row():
|
204 |
+
apply_button = gr.Button("Filtreyi Uygula", elem_id="apply-button", elem_classes="custom-button")
|
205 |
+
reset_button = gr.Button("Sıfırla", elem_id="reset-button", elem_classes="custom-button")
|
206 |
|
|
|
207 |
apply_button.click(fn=apply_filter, inputs=[filter_type, input_image], outputs=output_image)
|
208 |
+
reset_button.click(fn=reset_images, inputs=[], outputs=[input_image, output_image])
|
209 |
|
210 |
demo.launch()
|