blazingbunny commited on
Commit
6e50eae
·
verified ·
1 Parent(s): 922698b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py CHANGED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import nest_asyncio
2
+ nest_asyncio.apply()
3
+ # if you plan on using text_to_speech and GPT4-Vision models be sure to use the
4
+ # correct APIKEY
5
+ OPENAI_API_KEY = "YOUR API KEY"
6
+ GOOGLE_API_KEY = "YOUR API KEY"
7
+
8
+ from scrapegraphai.graphs import SearchGraph
9
+
10
+ # Define the configuration for the graph
11
+ graph_config = {
12
+ "llm": {
13
+ "api_key": 'OPENAI_API_KEY',
14
+ "model": "gpt-3.5-turbo",
15
+ "temperature": 0,
16
+ },
17
+ }
18
+
19
+ # Create the SearchGraph instance
20
+ search_graph = SearchGraph(
21
+ prompt="List me all the attributes of 'cannabis strain'.",
22
+ config=graph_config
23
+ )
24
+
25
+ result = search_graph.run()
26
+ import json
27
+
28
+ output = json.dumps(result, indent=2)
29
+
30
+ line_list = output.split("\n") # Sort of line replacing "\n" with a new line
31
+
32
+ for line in line_list:
33
+ print(line)