Spaces:
Sleeping
Sleeping
| # -*- coding: utf-8 -*- | |
| """gradio_code.ipynb | |
| Automatically generated by Colab. | |
| Original file is located at | |
| https://colab.research.google.com/drive/1tV8K1B35gpDCX7ocofxoEbvEa93-YKaD | |
| """ | |
| #pip install gradio | |
| #pip install stylecloud==0.5.2 | |
| # pip install Pillow==9.4.0 | |
| import gradio as gr | |
| import stylecloud | |
| from PIL import Image | |
| import os | |
| # fonksiyon tanımla | |
| def create_stylecloud(file,language,icon): | |
| text = file.decode("utf-8") | |
| output_file='stylecloud.png' | |
| stylecloud.gen_stylecloud( | |
| text = text, | |
| icon_name = icon, | |
| size = 500, | |
| output_name = output_file, | |
| ) | |
| # oluşturulan kelime bulutunun dosya adı | |
| return output_file | |
| ''' | |
| EKSTRA PARAMETRELER | |
| palette = 'cartocolors.qualitative.Bold_10', | |
| gradient = "horizontal", | |
| background_color = "white", | |
| collocations = False | |
| ''' | |
| # Gradio ile arayüzü oluştur | |
| 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-star-and-crescent", "fas fa-trophy", 'fas fa-laptop', "fas fa-heart", "fas fa-car",'fas fa-wifi'], | |
| label='İkon seçimi',value="fas fa-heart") | |
| create_button = gr.Button('Kelime Bulutu Oluştur') | |
| output_file = gr.File(label='Kelime Bulutunu İndir') | |
| # 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. |