FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ScrapegraphLib-Examples/nemotron/rate_limit_nemotron.py at main · ScrapeGraphAI/ScrapegraphLib-Examples · GitHub
ScrapeGraphAI
/
ScrapegraphLib-Examples
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
4
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ScrapegraphLib-Examples
/
nemotron
/
rate_limit_nemotron.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
47 lines (38 loc) · 1.27 KB
Breadcrumbs
ScrapegraphLib-Examples
/
nemotron
/
rate_limit_nemotron.py
Copy path
File metadata and controls
47 lines (38 loc) · 1.27 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""
Basic example of scraping pipeline using SmartScraper with a custom rate limit
"""
import
os
import
json
from
dotenv
import
load_dotenv
from
scrapegraphai
.
graphs
import
SmartScraperGraph
from
scrapegraphai
.
utils
import
prettify_exec_info
load_dotenv
()
# ************************************************
# Define the configuration for the graph
# ************************************************
graph_config
=
{
"llm"
: {
"api_key"
:
os
.
getenv
(
"NEMOTRON_KEY"
),
"model"
:
"nvidia/meta/llama3-70b-instruct"
,
"rate_limit"
: {
"requests_per_second"
:
1
}
},
"verbose"
:
True
,
"headless"
:
False
,
}
# ************************************************
# Create the SmartScraperGraph instance and run it
# ************************************************
smart_scraper_graph
=
SmartScraperGraph
(
prompt
=
"Extract me the python code inside the page"
,
source
=
"https://www.exploit-db.com/exploits/51447"
,
config
=
graph_config
)
result
=
smart_scraper_graph
.
run
()
print
(
json
.
dumps
(
result
,
indent
=
4
))
# ************************************************
# Get graph execution info
# ************************************************
graph_exec_info
=
smart_scraper_graph
.
get_execution_info
()
print
(
prettify_exec_info
(
graph_exec_info
))
Back
|
FazBrowse Home
|
New Git URL