efeperro commited on
Commit
f221d3b
Β·
verified Β·
1 Parent(s): 4a6be50

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +24 -10
src/streamlit_app.py CHANGED
@@ -1,20 +1,34 @@
1
- # app/streamlit_app.py
2
- import os, sys
3
 
4
- # Redirigir StreamlitConfig a /tmp/.streamlit (evita problema de permisos en '/.streamlit')
 
 
5
  os.environ["STREAMLIT_CONFIG_DIR"] = "/tmp/.streamlit"
6
- os.makedirs(os.environ["STREAMLIT_CONFIG_DIR"], exist_ok=True)
7
-
8
- # AΓ±adimos src/ a sys.path para que Python encuentre agent/ y tools/
9
- SRC_PATH = os.path.join(os.getcwd(), "src")
10
- if SRC_PATH not in sys.path:
11
- sys.path.append(SRC_PATH)
12
-
 
 
 
 
 
 
 
 
 
13
  import streamlit as st
14
  from agent.linkedin_agent import create_agent
15
  from tools.web_search_tool import get_web_search_tool
16
  from agents import Runner
17
 
 
 
 
18
 
19
  st.set_page_config(page_title="Buscador de Perfiles LinkedIn", layout="centered")
20
 
 
1
+ import os
2
+ import sys
3
 
4
+ # ───────────────────────────────────────────────────
5
+ # 1) Forzar a Streamlit a usar /tmp/.streamlit (es escribible en HF Spaces)
6
+ # ───────────────────────────────────────────────────
7
  os.environ["STREAMLIT_CONFIG_DIR"] = "/tmp/.streamlit"
8
+ # Nos aseguramos de que /tmp/.streamlit exista
9
+ try:
10
+ os.makedirs("/tmp/.streamlit", exist_ok=True)
11
+ except Exception:
12
+ pass
13
+
14
+ # ───────────────────────────────────────────────────
15
+ # 2) Meter src/ en sys.path para hallar agent/ y tools/
16
+ # ───────────────────────────────────────────────────
17
+ HERE = os.path.dirname(__file__) # apunta a /app/src
18
+ if HERE not in sys.path:
19
+ sys.path.insert(0, HERE)
20
+
21
+ # ───────────────────────────────────────────────────
22
+ # 3) Ahora sΓ­ importamos Streamlit y el resto
23
+ # ───────────────────────────────────────────────────
24
  import streamlit as st
25
  from agent.linkedin_agent import create_agent
26
  from tools.web_search_tool import get_web_search_tool
27
  from agents import Runner
28
 
29
+ # … resto de tu cΓ³digo de UI/ lΓ³gica de Streamlit …
30
+
31
+
32
 
33
  st.set_page_config(page_title="Buscador de Perfiles LinkedIn", layout="centered")
34