|
import streamlit as st |
|
from scrapegraphai.graphs import SmartScraperGraph |
|
|
|
st.title("web scrapping AI Agent ") |
|
st.caption("This app allows you to scrape a site using OpenAI API") |
|
|
|
graph_config = { |
|
"llm": { |
|
"model" : "ollama/llama3", |
|
"temperature": 0, |
|
"format": "json", |
|
"base_url": "http://localhost:11434", |
|
}, |
|
"embeddings" : { |
|
"model": "ollama/nomic-embed-text", |
|
"base_url": "http://localhost:11434", |
|
}, |
|
"verbose": True, |
|
} |
|
|
|
url = st.text_input("Enter url you want to scrape") |
|
user_prompt = st.text_input("what you want AI Agent to scrape from the site?") |
|
|
|
smart_scraper_graph = SmartScraperGraph( |
|
prompt=user_prompt, |
|
source=url, |
|
config=graph_config |
|
) |
|
|
|
if st.button("Scrape"): |
|
result = smart_scraper_graph.run() |
|
st.write(result) |