Divyansh12 commited on
Commit
23ce696
·
verified ·
1 Parent(s): 14032f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import asyncio
2
  import nest_asyncio
3
  import json
 
4
  import streamlit as st
5
  from sentence_transformers import SentenceTransformer
6
  from scrapegraphai.graphs import SmartScraperMultiGraph
@@ -12,14 +13,15 @@ subprocess.run(["playwright", "install"])
12
  # Apply nest_asyncio to allow nested event loops
13
  nest_asyncio.apply()
14
 
 
 
 
15
  # Load the sentence transformer model
16
  model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
17
 
18
  # Streamlit Application
19
  st.title("Course Scraper from Analytics Vidhya")
20
 
21
- # API Key Input
22
- api_key = st.text_input("Enter your API Key:", type="password")
23
 
24
  # Prompt Input
25
  user_prompt = st.text_input("Enter your prompt for scraping:")
@@ -28,7 +30,7 @@ user_prompt = st.text_input("Enter your prompt for scraping:")
28
  graph_config = {
29
  "llm": {
30
  "model": "groq/llama3-70b-8192",
31
- "api_key": api_key,
32
  "temperature": 1
33
  },
34
  "embeddings": {
 
1
  import asyncio
2
  import nest_asyncio
3
  import json
4
+ from dotenv import load_dotenv
5
  import streamlit as st
6
  from sentence_transformers import SentenceTransformer
7
  from scrapegraphai.graphs import SmartScraperMultiGraph
 
13
  # Apply nest_asyncio to allow nested event loops
14
  nest_asyncio.apply()
15
 
16
+ load_dotenv()
17
+ GROQ_API_KEY = os.getenv('GROQ_API_KEY')
18
+
19
  # Load the sentence transformer model
20
  model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
21
 
22
  # Streamlit Application
23
  st.title("Course Scraper from Analytics Vidhya")
24
 
 
 
25
 
26
  # Prompt Input
27
  user_prompt = st.text_input("Enter your prompt for scraping:")
 
30
  graph_config = {
31
  "llm": {
32
  "model": "groq/llama3-70b-8192",
33
+ "api_key": GROQ_API_KEY,
34
  "temperature": 1
35
  },
36
  "embeddings": {