Erayss commited on
Commit
9ea88f8
1 Parent(s): 86ba49a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +65 -10
app.py CHANGED
@@ -13,7 +13,7 @@ nltk.download('stopwords')
13
  nltk.download('punkt')
14
 
15
  def preprocess_and_create_stylecloud(file_path, output_name='stylecloud.png',
16
- icon_name='fas fa-laptop', lang='english'):
17
  # Metni dosyadan oku
18
  with open(file_path, 'r', encoding='utf-8') as f:
19
  text = f.read()
@@ -45,12 +45,6 @@ def preprocess_and_create_stylecloud(file_path, output_name='stylecloud.png',
45
  plt.axis('off') # Eksenleri gizle
46
  plt.show()
47
 
48
- #pip install pillow==9.4
49
-
50
-
51
- preprocess_and_create_stylecloud(file_path='AI.txt',
52
- output_name='computer_ai.png', icon_name='fas fa-laptop', lang='english')
53
-
54
  import streamlit as st
55
  import stylecloud
56
 
@@ -65,15 +59,76 @@ def create_stylecloud(text, language, icon):
65
 
66
  st.title("WordCloud Creator")
67
 
68
- file = st.file_uploader("Import txt file", type=["txt"])
69
 
70
  if file is not None:
71
  text = file.getvalue().decode("utf-8")
72
 
73
  language = st.radio("Language", ["tr", "en"])
74
 
75
- icon_options = ["fas fa-car", "fas fa-star", "fas fa-trophy", "fas fa-heart", 'fas fa-wifi', 'fas fa-laptop', 'fas fa-coffee', 'fas fa-radio', 'fas fa-snowflake']
76
- icon = st.selectbox("İkon Seçimi", icon_options, index=1)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
  if st.button("Create"):
79
  output_file = create_stylecloud(text, language, icon)
 
13
  nltk.download('punkt')
14
 
15
  def preprocess_and_create_stylecloud(file_path, output_name='stylecloud.png',
16
+ icon_name='fas fa-coffe', lang='english'):
17
  # Metni dosyadan oku
18
  with open(file_path, 'r', encoding='utf-8') as f:
19
  text = f.read()
 
45
  plt.axis('off') # Eksenleri gizle
46
  plt.show()
47
 
 
 
 
 
 
 
48
  import streamlit as st
49
  import stylecloud
50
 
 
59
 
60
  st.title("WordCloud Creator")
61
 
62
+ file = st.file_uploader("Text File Import", type=["txt"])
63
 
64
  if file is not None:
65
  text = file.getvalue().decode("utf-8")
66
 
67
  language = st.radio("Language", ["tr", "en"])
68
 
69
+ icon_options = [
70
+ "fas fa-car",
71
+ "fas fa-star",
72
+ "fas fa-trophy",
73
+ "fas fa-heart",
74
+ "fas fa-wifi",
75
+ "fas fa-laptop",
76
+ "fas fa-coffee",
77
+ "fas fa-radio",
78
+ "fas fa-snowflake",
79
+ "fas fa-apple",
80
+ "fas fa-basketball-ball",
81
+ "fas fa-bell",
82
+ "fas fa-bicycle",
83
+ "fas fa-binoculars",
84
+ "fas fa-birthday-cake",
85
+ "fas fa-blender",
86
+ "fas fa-bomb",
87
+ "fas fa-book",
88
+ "fas fa-bowling-ball",
89
+ "fas fa-box",
90
+ "fas fa-bread-slice",
91
+ "fas fa-briefcase",
92
+ "fas fa-broom",
93
+ "fas fa-brush",
94
+ "fas fa-bug",
95
+ "fas fa-building",
96
+ "fas fa-bullhorn",
97
+ "fas fa-bullseye",
98
+ "fas fa-bus",
99
+ "fas fa-calculator",
100
+ "fas fa-calendar",
101
+ "fas fa-camera",
102
+ "fas fa-campground",
103
+ "fas fa-candy-cane",
104
+ "fas fa-carrot",
105
+ "fas fa-cat",
106
+ "fas fa-chair",
107
+ "fas fa-chess",
108
+ "fas fa-chess-king",
109
+ "fas fa-chess-knight",
110
+ "fas fa-chess-pawn",
111
+ "fas fa-chess-queen",
112
+ "fas fa-chess-rook",
113
+ "fas fa-child",
114
+ "fas fa-church",
115
+ "fas fa-circle",
116
+ "fas fa-city",
117
+ "fas fa-clipboard",
118
+ "fas fa-clock",
119
+ "fas fa-cloud",
120
+ "fas fa-cloud-moon",
121
+ "fas fa-cloud-sun",
122
+ "fas fa-cocktail",
123
+ "fas fa-code",
124
+ "fas fa-coins",
125
+ "fas fa-compass",
126
+ "fas fa-cookie",
127
+ "fas fa-couch",
128
+ "fas fa-crown"
129
+ ]
130
+
131
+ icon = st.selectbox("Select Icon", icon_options, index=1)
132
 
133
  if st.button("Create"):
134
  output_file = create_stylecloud(text, language, icon)