Code: # Import the required libraries import streamlit as st from scrapegraphai.graphs…
- User
Code: # Import the required libraries import streamlit as st from scrapegraphai.graphs import SmartScraperGraph
Set up the Streamlit app
st.title("Web Scrapping AI Agent 🕵️♂️") st.caption("This app allows you to scrape a website using OpenAI API")
Set up the configuration for the SmartScraperGraph
graph_config = { "llm": { "model": "erida-THINK:latest", "temperature": 0, "format": "json", # Ollama needs the format to be specified explicitly "base_url": "http://localhost:11434", # set Ollama URL }, "embeddings": { "model": "ollama/nomic-embed-text", "base_url": "http://localhost:11434", # set Ollama URL }, "verbose": True, }
Get the URL of the website to scrape
url = st.text_input("Enter the URL of the website you want to scrape")
Get the user prompt
user_prompt = st.text_input("What you want the AI agent to scrae from the website?")
Create a SmartScraperGraph object
smart_scraper_graph = SmartScraperGraph( prompt=user_prompt, source=url, config=graph_config )
Scrape the website
if st.button("Scrape"): result = smart_scraper_graph.run() st.write(result)Error: File "C:\Users\Dell\AI\pythonProject.venv\Lib\site-packages\streamlit\runtime\scriptrunner\exec_code.py", line 88, in exec_func_with_error_handling result = func() ^^^^^^ File "C:\Users\Dell\AI\pythonProject.venv\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 590, in code_to_exec exec(code, module.dict) File "C:\Users\Dell\AI\pythonProject!EridAI\web_scapping\main.py", line 29, in smart_scraper_graph = SmartScraperGraph( ^^^^^^^^^^^^^^^^^^ File "C:\Users\Dell\AI\pythonProject.venv\Lib\site-packages\scrapegraphai\graphs\smart_scraper_graph.py", line 49, in init super().init(prompt, config, source, schema) File "C:\Users\Dell\AI\pythonProject.venv\Lib\site-packages\scrapegraphai\graphs\abstract_graph.py", line 57, in init self.llm_model = self._create_llm(config["llm"]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Dell\AI\pythonProject.venv\Lib\site-packages\scrapegraphai\graphs\abstract_graph.py", line 148, in _create_llm llm_params["model"] = split_model_provider[1] ~~~~~~~~~~~~~~~~~~~~^^^
- Assistant