KAARIN commited on
Commit
7147c6f
1 Parent(s): c1719f3

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -4
app.py CHANGED
@@ -1,11 +1,48 @@
1
  #!/usr/bin/env python
2
  # coding: utf-8
3
 
 
 
 
 
4
  import stylecloud
5
  from PIL import Image
6
- import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
- def create_stylecloud(file, text_input, language, icon):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  # Dosya veya text inputtan gelen metni kullan
10
  if file:
11
  text = file.decode('utf-8')
@@ -13,6 +50,9 @@ def create_stylecloud(file, text_input, language, icon):
13
  text = text_input
14
  else:
15
  return None # Eğer ikisi de yoksa None döner
 
 
 
16
 
17
  output_file = 'stylecloud.png'
18
  stylecloud.gen_stylecloud(
@@ -42,8 +82,7 @@ with gr.Blocks() as demo:
42
  language = gr.Radio(choices=['TR', 'EN'], label='Dil Seçimi', value='TR')
43
 
44
  with gr.Row():
45
- icon = gr.Dropdown(choices=["fas fa-car", "fas fa-star-and-crescent", "fas fa-trophy", "fas fa-heart"],
46
- label='İkon Seçimi', value='fas fa-star-and-crescent')
47
 
48
  with gr.Row():
49
  create_button = gr.Button('Oluştur')
@@ -71,3 +110,8 @@ with gr.Blocks() as demo:
71
  demo.launch(share=True)
72
 
73
 
 
 
 
 
 
 
1
  #!/usr/bin/env python
2
  # coding: utf-8
3
 
4
+ # In[1]:
5
+
6
+
7
+ import gradio as gr
8
  import stylecloud
9
  from PIL import Image
10
+ import os
11
+
12
+
13
+ # In[2]:
14
+
15
+
16
+ import importlib.metadata
17
+
18
+ try:
19
+ version = importlib.metadata.version('stylecloud')
20
+ print(f'stylecloud version: {version}')
21
+ except importlib.metadata.PackageNotFoundError:
22
+ print('stylecloud package is not installed')
23
+
24
+
25
+ # In[12]:
26
 
27
+
28
+ import PIL
29
+ print(PIL.__version__)
30
+
31
+
32
+ # In[26]:
33
+
34
+
35
+ # İkon etiketlerini ve değerlerini eşlemek için bir sözlük oluşturun
36
+ icon_map = {
37
+ "Araba": "fas fa-car",
38
+ "Hilal ve Yıldız": "fas fa-star-and-crescent",
39
+ "Kupa": "fas fa-trophy",
40
+ "Kalp": "fas fa-heart",
41
+ "Bulut": "fas fa-cloud",
42
+ "Hediye": "fas fa-gift"
43
+ }
44
+
45
+ def create_stylecloud(file, text_input, language, icon_label):
46
  # Dosya veya text inputtan gelen metni kullan
47
  if file:
48
  text = file.decode('utf-8')
 
50
  text = text_input
51
  else:
52
  return None # Eğer ikisi de yoksa None döner
53
+
54
+ # İkon etiketini ikon değerine dönüştür
55
+ icon = icon_map[icon_label]
56
 
57
  output_file = 'stylecloud.png'
58
  stylecloud.gen_stylecloud(
 
82
  language = gr.Radio(choices=['TR', 'EN'], label='Dil Seçimi', value='TR')
83
 
84
  with gr.Row():
85
+ icon = gr.Dropdown(choices=list(icon_map.keys()), label='İkon Seçimi', value='Hilal ve Yıldız')
 
86
 
87
  with gr.Row():
88
  create_button = gr.Button('Oluştur')
 
110
  demo.launch(share=True)
111
 
112
 
113
+ # In[ ]:
114
+
115
+
116
+
117
+