Spaces:
Build error
Build error
from flask import Flask, render_template, request | |
from eel import init, start | |
import requests | |
app = Flask(__name__, static_folder='static') | |
init("web") # eel will look for web folder | |
BASE_URL = "https://oevortex-webscout-api.hf.space" | |
def index(): | |
return render_template('index.html') | |
def get_suggestions(): | |
query = request.args.get('q') | |
api_endpoint = f"{BASE_URL}/api/suggestions?q={query}" | |
response = requests.get(api_endpoint) | |
response.raise_for_status() # Raise an error for bad responses | |
return response.json() | |
def perform_search(): | |
query = request.args.get('q') | |
timelimit = request.args.get('timelimit', 'none') | |
safesearch = request.args.get('safesearch', 'off') | |
api_endpoint = f"{BASE_URL}/api/search?q={query}&max_results=100&timelimit={timelimit}&safesearch={safesearch}" | |
response = requests.get(api_endpoint) | |
response.raise_for_status() # Raise an error for bad responses | |
return response.json() | |
def get_people_also_search(): | |
query = request.args.get('q') | |
api_endpoint = f"{BASE_URL}/api/answers?q={query}" | |
response = requests.get(api_endpoint) | |
response.raise_for_status() | |
return response.json() | |
if __name__ == "__main__": | |
start('index.html', mode='chrome', port=8080) |