by Lazy Sloth
WebSolution Finder
import logging
from fastapi import FastAPI, Form, Request
from fastapi.responses import HTMLResponse, RedirectResponse
from fastapi.responses import HTMLResponse
from fastapi.templating import Jinja2Templates
# Removed WebFetcher import as it's no longer needed with the new Google CSE integration
import uvicorn
from typing import List
from abilities import llm_prompt
app = FastAPI()
templates = Jinja2Templates(directory="templates")
# Removed SolutionFinder class as it's no longer needed with the new Google CSE integration
import json
@app.get("/", response_class=HTMLResponse)
async def read_index(request: Request):
return templates.TemplateResponse("index.html", {"request": request})
@app.get("/solutions", response_class=HTMLResponse)
async def solutions(request: Request):
solutions = request.app.state.solutions
WebSolution Finder
Created: | Last Updated:
Introduction to the WebSolution Finder Template
Welcome to the WebSolution Finder template! This template is designed to help you build a web application that uses FastAPI to serve a list of potential solutions for various problems or issues. The app integrates with Google Custom Search Engine (CSE) to provide a search interface and displays the results in a simple web page. Whether you're looking to create a resource for troubleshooting or a curated list of helpful links, this template will get you started quickly and efficiently.
Getting Started with the Template
To begin using the WebSolution Finder template, simply click on "Start with this Template" in the Lazy builder interface. This will pre-populate the code in the Lazy Builder, so you won't need to copy, paste, or delete any code manually.
Test: Deploying the App
Once you have started with the template, the next step is to deploy the app to see it in action. Press the "Test" button in the Lazy builder interface. This will initiate the deployment process and launch the Lazy CLI. If the template requires any user input, you will be prompted to provide it through the Lazy CLI after pressing the "Test" button.
Using the App
After deploying the app, you will be provided with a dedicated server link to access the web interface. The main page will feature a Google CSE search box where you can enter queries. The results will be displayed on a separate page, listing potential solutions with links to more information.
If the app uses FastAPI, which it does in this case, you will also be provided with a link to the FastAPI documentation. This can be useful if you want to understand more about how the API works or if you plan to extend the functionality of the app.
Integrating the App
If you wish to integrate the WebSolution Finder app into another service or frontend, you will need to use the server link provided by Lazy. This link can be added to external tools that support web integrations. For example, you might add the link to a company intranet page, allowing employees to access the solution finder directly from there.
Remember, the Lazy platform handles all the deployment details, so you don't need to worry about setting up environments or installing libraries. Just focus on how you want to use the app and integrate it with other tools or services as needed.
If you encounter any issues or have questions about integrating the app, refer to the provided documentation links or reach out for support through the Lazy platform.
Happy building with the WebSolution Finder template!
Technologies
![Streamlit](https://raw.githubusercontent.com/github/explore/968d1eb8fb6b704c6be917f0000283face4f33ee/topics/streamlit/streamlit.png)
![Python](https://i.pinimg.com/originals/2f/9c/11/2f9c11f9e55efbf1791f12c06d60729b.jpg)