Spaces:
Sleeping
Sleeping
import gradio as gr | |
from bing_image_downloader import downloader | |
import shutil | |
import os | |
def downloader_images(search_query, limit ,adult_filter_off,timeout=20): | |
# Bing1 den resim indirme işlemi | |
adult_filter=adult_filter_off =="True" | |
downloader.download( | |
search_query, | |
limit=limit, | |
adult_filter_off=adult_filter, | |
force_replace=False, | |
timeout=timeout | |
) | |
# indirilen resimleri zip e dönüştürme | |
output_dir=f"dataset/{search_query}" | |
zip_filename=f"{search_query}.zip" | |
shutil.make_archive(search_query,"zip",output_dir) | |
zip_path=f"{zip_filename}" | |
return zip_path | |
# Gradio arayüzü oluştur | |
interface = gr.Interface( | |
fn=downloader_images, | |
inputs=[ | |
gr.Textbox(label='Aranacak kelime'), | |
gr.Slider(1, 100, step=5, label='Görsel sayısı'), | |
gr.Radio(["True", "False"], label="Korumalı mod", value="True") | |
], | |
outputs=gr.File(label="İndirilen Görseller"), | |
title="Bing ile Görsel İndirme", | |
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.", | |
examples=[ | |
["kedi", 20, "True"] | |
] | |
) | |
# Arayüzü başlat | |
interface.launch(share=True) | |