Yermek68 commited on
Commit
08b5d1c
·
verified ·
1 Parent(s): bf42b73

Create summarizer.py

Browse files
Files changed (1) hide show
  1. summarizer.py +16 -0
summarizer.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+
3
+ def summarize_via_hf(text: str):
4
+ """
5
+ Отправляет текст в Eroha Summarizer PRO (на Hugging Face)
6
+ и возвращает краткое резюме.
7
+ """
8
+ url = "https://yermek68-eroha-agentapi.hf.space/api/summarize"
9
+ try:
10
+ response = requests.post(url, json={"text": text}, timeout=30)
11
+ if response.status_code == 200:
12
+ return response.json().get("summary", "")
13
+ else:
14
+ return f"Ошибка: {response.status_code}"
15
+ except Exception as e:
16
+ return f"Ошибка соединения: {e}"