File size: 815 Bytes
b11ad8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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)