MatteoScript commited on
Commit
e402ae5
·
verified ·
1 Parent(s): 868f0f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -8,10 +8,27 @@ import traceback
8
  import sys
9
  from dotenv import load_dotenv
10
  import json
 
11
 
12
  st.set_page_config(layout="wide", page_title="Generatore Excel AI")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
- load_dotenv()
15
  API_KEY = os.getenv("API_HUGGINGFACE")
16
  BASE_URL = "https://matteoscript-ai.hf.space/v1/"
17
  MODEL_NAME = "gemini-2.5-flash-preview-05-20" # Sostituisci con il tuo modello preferito
@@ -284,7 +301,6 @@ def render_sidebar():
284
  )
285
 
286
  def render_main_content():
287
- st.title("📊 Generatore Excel AI")
288
  st.markdown("Definisci richiesta e numero Fogli, poi l'AI **pianificherà, genererà, collegherà** e tenterà di auto-correggere gli script dei fogli")
289
 
290
  if st.sidebar.button("💡 Pianifica Fogli con AI", type="primary", use_container_width=True):
 
8
  import sys
9
  from dotenv import load_dotenv
10
  import json
11
+ load_dotenv()
12
 
13
  st.set_page_config(layout="wide", page_title="Generatore Excel AI")
14
+ st.title("📊 Generatore Excel AI")
15
+
16
+ if "logged" not in st.session_state:
17
+ st.session_state.logged = False
18
+ if st.session_state.logged == False:
19
+ login_placeholder = st.empty()
20
+ with login_placeholder.container():
21
+ container = st.container(border=True)
22
+ username = container.text_input('Username')
23
+ password = container.text_input('Passowrd', type='password')
24
+ login = container.button(' Login ', type='primary')
25
+ if not login or username != os.getenv("LOGIN_USER") or password != os.getenv("LOGIN_PASSWORD"):
26
+ if login:
27
+ st.error('Password Errata')
28
+ st.stop()
29
+ st.session_state.logged = True
30
+ login_placeholder.empty()
31
 
 
32
  API_KEY = os.getenv("API_HUGGINGFACE")
33
  BASE_URL = "https://matteoscript-ai.hf.space/v1/"
34
  MODEL_NAME = "gemini-2.5-flash-preview-05-20" # Sostituisci con il tuo modello preferito
 
301
  )
302
 
303
  def render_main_content():
 
304
  st.markdown("Definisci richiesta e numero Fogli, poi l'AI **pianificherà, genererà, collegherà** e tenterà di auto-correggere gli script dei fogli")
305
 
306
  if st.sidebar.button("💡 Pianifica Fogli con AI", type="primary", use_container_width=True):