from fastapi import FastAPI import requests from bs4 import BeautifulSoup import re app = FastAPI(title="Deploying FastAPI Apps on Huggingface") @app.get("/", tags=["Home"]) def api_home(): return {'detail': 'Welcome to FastAPI Tutorial!'} @app.post("/",tags=["hello"]) def hello(name: str): return {'message': f"hello {name}!"} @app.get("/scrape", tags=["Scrape"]) def scrape(url: str): response = requests.get(url) soup = BeautifulSoup(response.text, "html.parser") return soup.prettify()