Spaces:
Sleeping
Sleeping
File size: 509 Bytes
6299828 e72aab2 6299828 e72aab2 6299828 813b96d e72aab2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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() |