Pegumenezes commited on
Commit
3a7f746
verified
1 Parent(s): 3f773f0

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +7 -1
src/streamlit_app.py CHANGED
@@ -29,6 +29,13 @@ o pre莽o de venda dos im贸veis. O dashboard est谩 dividido em duas etapas princi
29
  # --- Download e Carregamento do Dataset (com cache para performance) ---
30
  @st.cache_data
31
  def load_data():
 
 
 
 
 
 
 
32
  dataset_path = kagglehub.dataset_download("prevek18/ames-housing-dataset")
33
  csv_file_path = next(
34
  os.path.join(root, file)
@@ -38,7 +45,6 @@ def load_data():
38
  df = pd.read_csv(csv_file_path)
39
  df.columns = df.columns.str.replace('[^A-Za-z0-9_]+', '', regex=True).str.lower()
40
 
41
- # Cria a vari谩vel 'area_faixa'
42
  if 'grlivarea' in df.columns:
43
  bins = [0, 1000, 1500, 2000, 2500, 3000, 4000, df['grlivarea'].max() + 1]
44
  labels = ['<1000', '1000-1500', '1500-2000', '2000-2500', '2500-3000', '3000-4000', '4000+']
 
29
  # --- Download e Carregamento do Dataset (com cache para performance) ---
30
  @st.cache_data
31
  def load_data():
32
+ # Define um diret贸rio de cache em um local com permiss茫o de escrita (/tmp/)
33
+ # Isso resolve o erro de permiss茫o em ambientes de nuvem.
34
+ cache_dir = "/tmp/kagglehub"
35
+ os.makedirs(cache_dir, exist_ok=True)
36
+ os.environ['KAGGLE_CACHE_DIR'] = cache_dir
37
+
38
+ # O resto da fun莽茫o continua igual
39
  dataset_path = kagglehub.dataset_download("prevek18/ames-housing-dataset")
40
  csv_file_path = next(
41
  os.path.join(root, file)
 
45
  df = pd.read_csv(csv_file_path)
46
  df.columns = df.columns.str.replace('[^A-Za-z0-9_]+', '', regex=True).str.lower()
47
 
 
48
  if 'grlivarea' in df.columns:
49
  bins = [0, 1000, 1500, 2000, 2500, 3000, 4000, df['grlivarea'].max() + 1]
50
  labels = ['<1000', '1000-1500', '1500-2000', '2000-2500', '2500-3000', '3000-4000', '4000+']