Spaces:
Sleeping
Sleeping
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 "" |