Spaces:
Sleeping
Sleeping
File size: 463 Bytes
6d73c15 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
from fastapi import Body
from loguru import logger
from schemas import TextModelRequest
from scraper import extract_urls, fetch_all
async def get_urls_content(body: TextModelRequest ) -> str:
urls = extract_urls(body.prompt)
if urls:
try:
urls_content = await fetch_all(urls)
return urls_content
except Exception as e:
logger.warning(f"Failed to fetch one or several URls - Error: {e}")
return "" |