drmurataltun commited on
Commit
3c2f7a9
·
verified ·
1 Parent(s): 1d01477

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from bing_image_downloader import downloader
3
+
4
+ def downloader_images(search_query, limit, adult_filter_off, timeout=20):
5
+ # Bing'den resim indirme işlemi
6
+ adult_filter = adult_filter_off == "True"
7
+ downloader.download(
8
+ search_query,
9
+ limit=limit,
10
+ adult_filter_off=adult_filter,
11
+ force_replace=False,
12
+ timeout=timeout
13
+ )
14
+ return f'{limit} adet "{search_query}" fotoğrafı indirildi.'
15
+
16
+ # Gradio arayüzü oluştur
17
+ interface = gr.Interface(
18
+ fn=downloader_images,
19
+ inputs=[
20
+ gr.Textbox(label='Aranacak kelime'),
21
+ gr.Slider(1, 100, step=5, label='Görsel sayısı'),
22
+ gr.Radio(["True", "False"], label="Korumalı mod", value="True")
23
+ ],
24
+ outputs="text",
25
+ title="Bing ile görsel indirme",
26
+ description="İndirmek istediğiniz resmi tanımlayınız. İlgili ayarlardan korumalı mod seçeneğini ve indirmek istediğiniz görsel sayısını belirleyebilirsiniz.",
27
+ examples=[
28
+ ["cat", 20, "True"]
29
+ ]
30
+ )
31
+
32
+ # Arayüzü başlat
33
+ interface.launch(share=True)