Abhaykoul commited on
Commit
95c9859
1 Parent(s): bf3028a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -4,8 +4,22 @@ from webscout.LLM import LLM
4
 
5
  app = Flask(__name__)
6
 
7
- @app.route('/search', methods=['GET'])
8
  def WEBScout2_search_search():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  query = request.args.get('query')
10
  if not query:
11
  return jsonify({'error': 'Query parameter missing'})
 
4
 
5
  app = Flask(__name__)
6
 
7
+ @app.route('/search', methods=['POST'])
8
  def WEBScout2_search_search():
9
+ data = request.get_json()
10
+ if 'query' not in data:
11
+ return jsonify({'error': 'Query parameter missing'})
12
+
13
+ query = data['query']
14
+ limit = data.get('limit', 10) # Default limit to 10 if not provided
15
+ WEBS_instance = WEBS() # Instantiate WEBS without context manager
16
+ responses = []
17
+ for i, r in enumerate(WEBS_instance.text(query, region='wt-wt', safesearch='off', timelimit='y')):
18
+ responses.append(r)
19
+ return jsonify(responses)
20
+
21
+ @app.route('/int', methods=['GET'])
22
+ def WEBScout3_search_search_search_search():
23
  query = request.args.get('query')
24
  if not query:
25
  return jsonify({'error': 'Query parameter missing'})