miturkoglu96 commited on
Commit
32c9194
·
verified ·
1 Parent(s): 46ffabc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +76 -43
app.py CHANGED
@@ -1,43 +1,76 @@
1
- import gradio as gr
2
- import stylecloud
3
- from PIL import Image
4
- import os
5
- #fonksiyon tanımla
6
- def create_stylecloud(file,language,icon):
7
- #icon kodları için :https://fontawesome.com/icons
8
- text=file.decode("utf-8")
9
- output_file='stylecloud.png'
10
-
11
- #kelime bulutu oluştur
12
- stylecloud.gen_stylecloud(
13
- text=text,
14
- icon_name=icon,
15
- size=500,
16
- output_name=output_file,
17
- )
18
- #oluşturlan kelime bulutunun dosya adı
19
- return output_file
20
- '''
21
- Extra paretmetreler
22
- palette="cartocolors.qualitative.Bold_10",
23
- gradient="horizontal",
24
- background_color="white",
25
- collocations=False
26
- '''
27
- #Gradio arayüzünü oluştur
28
- with gr.Blocks() as demo:
29
- gr.Markdown('Kelime Bulutu Oluşturucu')
30
- with gr.Row():
31
- file_input=gr.File(label='Metin dosyasını yükle', type='binary')
32
- language=gr.Radio(choices=['TR', 'En'],label='Dil Seçimi', value='TR')
33
- icon=gr.Dropdown(choices=["fas fa-car", "fas fa-star-and-crescent", "fas fa-trophy", "fas fa-heart"],
34
- label='İkon seçimi',value="fas fa-car")
35
- output_file=gr.File(label='Kelime Bulutunu indir')
36
- create_button=gr.Button('Oluştur')
37
- #butona basıldığında
38
- create_button.click(
39
- create_stylecloud,
40
- inputs=[file_input,language,icon],
41
- outputs=output_file
42
- )
43
- demo.launch(share=True) #share=True public lnk verir
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import stylecloud
3
+ from PIL import Image
4
+ import os
5
+
6
+ #fonksiyon tanımla
7
+ def create_stylecloud(file,language,icon):
8
+ # Dosya yolunu ve içerik türünü belirleyin
9
+ #icon kodları ve daha fazlası için ==>> https://fontawesome.com/icons
10
+ text=file.decode("utf-8")
11
+ output_file='stylecloud.png' # Çıktı dosyasının ismi
12
+
13
+ #Kelime bulutunu oluştur
14
+ stylecloud.gen_stylecloud(
15
+ text=text,
16
+ icon_name=icon,
17
+ size=500,
18
+ output_name=output_file,
19
+ )
20
+
21
+ #oluşturulan kelime bulutunun dosya adı
22
+ return output_file
23
+ '''
24
+ Extra paretmetreler
25
+ palette="cartocolors.qualitative.Bold_10",
26
+ gradient="horizontal",
27
+ background_color="white",
28
+ collocations=False
29
+ '''
30
+ #Gradio arayüzünü oluşturma
31
+ with gr.Blocks() as demo:
32
+ gr.Markdown('Kelime Bulutu Oluşturucu')
33
+ with gr.Row():
34
+ file_input=gr.File(label='Metin dosyasını yükle', type='binary')
35
+ language=gr.Radio(choices=['TR', 'EN'],label='Dil Seçimi', value='TR')
36
+ icon = gr.Dropdown(
37
+ choices=[
38
+ "fas fa-car",
39
+ "fas fa-star-and-crescent",
40
+ "fas fa-trophy",
41
+ "fas fa-heart",
42
+ "far fa-smile",
43
+ "fab fa-github",
44
+ "fas fa-pizza-slice",
45
+ "fas fa-tree",
46
+ "fas fa-music",
47
+ "fas fa-film",
48
+ "fas fa-coffee",
49
+ "fas fa-biking",
50
+ "fas fa-atom",
51
+ "fas fa-robot",
52
+ "fas fa-microchip",
53
+ "fas fa-plane",
54
+ "fas fa-mountain",
55
+ "fas fa-phone",
56
+ "fas fa-comments",
57
+ "fas fa-envelope",
58
+ "fas fa-heartbeat",
59
+ "fas fa-dumbbell",
60
+ "fas fa-ice-cream",
61
+ "fab fa-adn",
62
+ "fab fa-apple"
63
+
64
+ ],
65
+ label='İkon seçimi',
66
+ value="fas fa-car")
67
+ output_file=gr.File(label='Kelime Bulutunu İndir')
68
+ create_button=gr.Button('Oluştur')
69
+
70
+ #butona basıldığında
71
+ create_button.click(
72
+ create_stylecloud,
73
+ inputs=[file_input,language,icon],
74
+ outputs=output_file
75
+ )
76
+ demo.launch(share=True) #share=True public link verir