yunuseduran commited on
Commit
dd24d58
·
verified ·
1 Parent(s): 18e9f33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -54,7 +54,11 @@ def preprocess_and_create_stylecloud(file_path, output_name='stylecloud.png',
54
  def create_stylecloud(text, language, icon):
55
  output_filename = "stylecloud.png"
56
  static_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static")
57
- os.makedirs(static_dir, exist_ok=True)
 
 
 
 
58
  output_file = os.path.join(static_dir, output_filename)
59
 
60
  stylecloud.gen_stylecloud(text=text, icon_name=icon, output_name=output_file)
@@ -115,6 +119,3 @@ if file is not None:
115
 
116
  image = Image.open("static/stylecloud.png")
117
  st.image(image, caption='WordCloud', use_column_width=True)
118
- # Ensure the file is deleted after display
119
- if not os.path.exists(STATIC_DIR):
120
- os.makedirs(STATIC_DIR)
 
54
  def create_stylecloud(text, language, icon):
55
  output_filename = "stylecloud.png"
56
  static_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static")
57
+
58
+ # Kontrol et, yoksa oluştur
59
+ if not os.path.exists(static_dir):
60
+ os.makedirs(static_dir)
61
+
62
  output_file = os.path.join(static_dir, output_filename)
63
 
64
  stylecloud.gen_stylecloud(text=text, icon_name=icon, output_name=output_file)
 
119
 
120
  image = Image.open("static/stylecloud.png")
121
  st.image(image, caption='WordCloud', use_column_width=True)