Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import stylecloud | |
| from PIL import Image | |
| import os | |
| # Fonksiyon tanımla | |
| def create_stylecloud(file,language,icon): | |
| # Dosya yolunu ve içerik türünü belirleyin | |
| # İcon kodları ve daha fazlası için ==>> https://fontawesome.com/icons | |
| text=file.decode("utf-8") | |
| output_file='stylecloud.png' # Çıktı dosyasının ismi | |
| # Kelime bulutunu oluştur | |
| stylecloud.gen_stylecloud( | |
| text=text, | |
| icon_name=icon, | |
| size=500, | |
| output_name=output_file, | |
| ) | |
| # Oluşturulan kelime bulutunun dosya adı (Görüntüyü Getir) | |
| return output_file | |
| ''' | |
| Extra paretmetreler | |
| palette="cartocolors.qualitative.Bold_10", | |
| gradient="horizontal", | |
| background_color="white", | |
| collocations=False | |
| ''' | |
| #Gradio arayüzünü oluşturma | |
| with gr.Blocks() as demo: | |
| gr.Markdown('Kelime Bulutu Oluşturucu') | |
| with gr.Row(): | |
| file_input=gr.File(label='Metin dosyasını yükle', type='binary') | |
| language=gr.Radio(choices=['TR', 'EN'],label='Dil Seçimi', value='TR') | |
| icon = gr.Dropdown( | |
| choices=[ | |
| "fas fa-car", | |
| "fas fa-star-and-crescent", | |
| "fas fa-trophy", | |
| "fas fa-heart", | |
| "far fa-smile", | |
| "fab fa-github", | |
| "fas fa-pizza-slice", | |
| "fas fa-tree", | |
| "fas fa-music", | |
| "fas fa-film", | |
| "fas fa-coffee", | |
| "fas fa-biking", | |
| "fas fa-atom", | |
| "fas fa-robot", | |
| "fas fa-microchip", | |
| "fas fa-plane", | |
| "fas fa-mountain", | |
| "fas fa-phone", | |
| "fas fa-comments", | |
| "fas fa-envelope", | |
| "fas fa-heartbeat", | |
| "fas fa-dumbbell", | |
| "fas fa-ice-cream", | |
| "fab fa-adn", | |
| "fab fa-apple" | |
| ], | |
| label='İkon seçimi', | |
| value="fas fa-car") | |
| output_file=gr.File(label='Kelime Bulutunu İndir') | |
| create_button=gr.Button('Oluştur') | |
| #butona basıldığında | |
| create_button.click( | |
| create_stylecloud, | |
| inputs=[file_input,language,icon], | |
| outputs=output_file | |
| ) | |
| demo.launch(share=True) #share=True public link verir |