eroha-agentapi / summarizer.py
Yermek68's picture
Create summarizer.py
08b5d1c verified
raw
history blame
601 Bytes
import requests
def summarize_via_hf(text: str):
"""
Отправляет текст в Eroha Summarizer PRO (на Hugging Face)
и возвращает краткое резюме.
"""
url = "https://yermek68-eroha-agentapi.hf.space/api/summarize"
try:
response = requests.post(url, json={"text": text}, timeout=30)
if response.status_code == 200:
return response.json().get("summary", "")
else:
return f"Ошибка: {response.status_code}"
except Exception as e:
return f"Ошибка соединения: {e}"