Update app.py
Browse files
app.py
CHANGED
@@ -5,23 +5,27 @@ import os
|
|
5 |
import PIL.Image
|
6 |
|
7 |
#fonksiyon tanımla
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
def create_stylecloud(file, language, icon):
|
9 |
-
|
10 |
-
output_file = f'stylecloud_{os.getpid()}.png'
|
11 |
-
|
12 |
-
# Tam dosya yolunu oluştur
|
13 |
-
output_path = os.path.join(os.getcwd(), output_file)
|
14 |
|
15 |
-
#
|
16 |
-
icon_unicode = icon_map.get(icon, "\uf1b9")
|
17 |
|
18 |
stylecloud.gen_stylecloud(
|
19 |
text=file,
|
20 |
icon_name=icon_unicode,
|
21 |
size=500,
|
22 |
-
output_name=
|
23 |
)
|
24 |
-
return
|
25 |
|
26 |
with gr.Blocks() as demo:
|
27 |
gr.Markdown('Kelime Bulutu Oluşturucu')
|
|
|
5 |
import PIL.Image
|
6 |
|
7 |
#fonksiyon tanımla
|
8 |
+
# FontAwesome icon sınıflarını unicode karakterlere eşleyen sözlük
|
9 |
+
icon_map = {
|
10 |
+
"fas fa-car": "\uf1b9",
|
11 |
+
"fas fa-star-and-crescent": "\uf699",
|
12 |
+
"fas fa-trophy": "\uf091",
|
13 |
+
"fas fa-heart": "\uf004"
|
14 |
+
}
|
15 |
+
|
16 |
def create_stylecloud(file, language, icon):
|
17 |
+
output_file = 'stylecloud.png'
|
|
|
|
|
|
|
|
|
18 |
|
19 |
+
# İkon değerini FontAwesome sınıf adından unicode karaktere dönüştür
|
20 |
+
icon_unicode = icon_map.get(icon, "\uf1b9") # Varsayılan olarak "fas fa-car" ikonu
|
21 |
|
22 |
stylecloud.gen_stylecloud(
|
23 |
text=file,
|
24 |
icon_name=icon_unicode,
|
25 |
size=500,
|
26 |
+
output_name=output_file,
|
27 |
)
|
28 |
+
return output_file
|
29 |
|
30 |
with gr.Blocks() as demo:
|
31 |
gr.Markdown('Kelime Bulutu Oluşturucu')
|