GaetanoParente commited on
Commit
1956ed8
·
verified ·
1 Parent(s): 24213b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -22
app.py CHANGED
@@ -140,33 +140,24 @@ tab_gen, tab_val, tab_vis = st.tabs([
140
  with tab_gen:
141
  # --- SELEZIONE FILE ---
142
  st.subheader("1. Sorgente Documentale")
143
-
144
- col_sel, col_info = st.columns([1, 2])
145
- with col_sel:
146
- data_source = st.radio("Modalità:", ("📂 Esempi Demo", "⬆️ Upload"), horizontal=True)
147
 
148
  selected_file = None
149
  os.makedirs("data/raw", exist_ok=True)
150
  os.makedirs("data/processed", exist_ok=True)
151
  os.makedirs("data/examples", exist_ok=True)
152
 
153
- if data_source == "📂 Esempi Demo":
154
- files = [f for f in os.listdir("data/examples") if f.endswith(".txt")]
155
- if files:
156
- choice = st.selectbox("Seleziona scenario:", files, index=0)
157
- if choice:
158
- src = os.path.join("data/examples", choice)
159
- dst = os.path.join("data/raw", choice)
160
- shutil.copy(src, dst)
161
- selected_file = choice
162
- else:
163
- st.warning("Nessun file in data/examples")
164
  else:
165
- uploaded = st.file_uploader("Carica .txt", type="txt")
166
- if uploaded:
167
- with open(os.path.join("data/raw", uploaded.name), "wb") as f:
168
- f.write(uploaded.getbuffer())
169
- selected_file = uploaded.name
170
 
171
  # Logica di cambio file: se cambia il file, resetta la pipeline
172
  if selected_file and selected_file != st.session_state.current_file:
@@ -175,7 +166,6 @@ with tab_gen:
175
  st.rerun()
176
 
177
  if not selected_file:
178
- st.info("👈 Seleziona o carica un file per iniziare.")
179
  st.stop()
180
 
181
  st.markdown("---")
@@ -299,7 +289,6 @@ with tab_gen:
299
  Puoi esplorarli nei tab "Validazione" e "Visualizzazione".
300
  </div>
301
  """, unsafe_allow_html=True)
302
- st.balloons()
303
  if st.button("Riavvia con nuovo file"):
304
  reset_pipeline()
305
  st.rerun()
 
140
  with tab_gen:
141
  # --- SELEZIONE FILE ---
142
  st.subheader("1. Sorgente Documentale")
143
+ st.info("Seleziona uno degli scenari dimostrativi validati per avviare la pipeline.")
 
 
 
144
 
145
  selected_file = None
146
  os.makedirs("data/raw", exist_ok=True)
147
  os.makedirs("data/processed", exist_ok=True)
148
  os.makedirs("data/examples", exist_ok=True)
149
 
150
+ # Logica semplificata: Solo esempi demo
151
+ files = [f for f in os.listdir("data/examples") if f.endswith(".txt")]
152
+ if files:
153
+ choice = st.selectbox("Scenario Disponibile:", files, index=0)
154
+ if choice:
155
+ src = os.path.join("data/examples", choice)
156
+ dst = os.path.join("data/raw", choice)
157
+ shutil.copy(src, dst)
158
+ selected_file = choice
 
 
159
  else:
160
+ st.warning("⚠️ Nessun file trovato in data/examples. Aggiungi file .txt alla cartella per procedere.")
 
 
 
 
161
 
162
  # Logica di cambio file: se cambia il file, resetta la pipeline
163
  if selected_file and selected_file != st.session_state.current_file:
 
166
  st.rerun()
167
 
168
  if not selected_file:
 
169
  st.stop()
170
 
171
  st.markdown("---")
 
289
  Puoi esplorarli nei tab "Validazione" e "Visualizzazione".
290
  </div>
291
  """, unsafe_allow_html=True)
 
292
  if st.button("Riavvia con nuovo file"):
293
  reset_pipeline()
294
  st.rerun()