File size: 2,338 Bytes
7f84678
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a00fe89
5b89c92
42bc5d3
7ede11b
 
7f84678
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env python
# coding: utf-8

# In[1]:


#pip install gradio


# In[2]:


#pip install stylecloud==0.5.2


# In[7]:


#pip show stylecloud


# In[8]:


#pip show icon_font_to_png


# In[26]:


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
    text = file.decode("utf-8")
    output_file = 'stylecloud.png'  # Çıktı dosyasının ismi
    
    # Kelime bulutu oluştur
    stylecloud.gen_stylecloud(
        text=text,           
        icon_name=icon,
        size=500,
        output_name=output_file
    )
    return output_file

# Gradio arayüzünü 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-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-heart"
        )
        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)


# In[ ]: