Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,26 +1,25 @@
|
|
| 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
|
| 8 |
-
import
|
|
|
|
| 9 |
import subprocess
|
| 10 |
|
| 11 |
subprocess.run(["playwright", "install"])
|
| 12 |
# Apply nest_asyncio to allow nested event loops
|
| 13 |
nest_asyncio.apply()
|
| 14 |
|
| 15 |
-
load_dotenv()
|
| 16 |
-
GROQ_API_KEY = os.getenv('GROQ_API_KEY')
|
| 17 |
-
|
| 18 |
# Load the sentence transformer model
|
| 19 |
model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
|
| 20 |
|
| 21 |
# Streamlit Application
|
| 22 |
st.title("Course Scraper from Analytics Vidhya")
|
| 23 |
|
|
|
|
|
|
|
| 24 |
|
| 25 |
# Prompt Input
|
| 26 |
user_prompt = st.text_input("Enter your prompt for scraping:")
|
|
@@ -29,7 +28,7 @@ user_prompt = st.text_input("Enter your prompt for scraping:")
|
|
| 29 |
graph_config = {
|
| 30 |
"llm": {
|
| 31 |
"model": "groq/llama3-70b-8192",
|
| 32 |
-
"api_key":
|
| 33 |
"temperature": 1
|
| 34 |
},
|
| 35 |
"embeddings": {
|
|
|
|
| 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
|
| 7 |
+
from langchain_groq import ChatGroq
|
| 8 |
+
|
| 9 |
import subprocess
|
| 10 |
|
| 11 |
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 |
graph_config = {
|
| 29 |
"llm": {
|
| 30 |
"model": "groq/llama3-70b-8192",
|
| 31 |
+
"api_key": api_key,
|
| 32 |
"temperature": 1
|
| 33 |
},
|
| 34 |
"embeddings": {
|