Engineer786 commited on
Commit
c97a441
·
verified ·
1 Parent(s): b4b1755

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -7,9 +7,9 @@ import faiss
7
  from groq import Groq
8
 
9
  # Fetch API key from environment variable
10
- API_KEY = os.environ.get("GroqApi")
11
 
12
- # Global variables for index, chunks, and model
13
  CHUNKS = None
14
  INDEX = None
15
  MODEL = None
@@ -73,7 +73,8 @@ url = st.text_input("Enter Tariff Data URL", "https://iesco.com.pk/index.php/cus
73
  if st.button("Process Tariff Data"):
74
  with st.spinner("Extracting and processing data..."):
75
  try:
76
- global CHUNKS, INDEX, MODEL # Ensure global declaration is at the top
 
77
  text = scrape_tariff_data(url)
78
  CHUNKS = chunk_text(text)
79
  INDEX, embeddings, MODEL = create_faiss_index(CHUNKS)
 
7
  from groq import Groq
8
 
9
  # Fetch API key from environment variable
10
+ API_KEY = os.environ.get("GroqApi)
11
 
12
+ # Initialize global variables
13
  CHUNKS = None
14
  INDEX = None
15
  MODEL = None
 
73
  if st.button("Process Tariff Data"):
74
  with st.spinner("Extracting and processing data..."):
75
  try:
76
+ # Declare globals and assign values
77
+ global CHUNKS, INDEX, MODEL
78
  text = scrape_tariff_data(url)
79
  CHUNKS = chunk_text(text)
80
  INDEX, embeddings, MODEL = create_faiss_index(CHUNKS)