Download toolbench/toolenv/tools/Text_Analysis/basla_emotion_analysis/api.py from Septzzz/gymcl-data: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/datasets/Septzzz/gymcl-data/resolve/main/toolbench/toolenv/tools/Text_Analysis/basla_emotion_analysis/api.py
- Command line
-
hf download hf://datasets/Septzzz/gymcl-data/toolbench/toolenv/tools/Text_Analysis/basla_emotion_analysis/api.py
-
curl -L -o api.py https://huggingface.co/datasets/Septzzz/gymcl-data/resolve/main/toolbench/toolenv/tools/Text_Analysis/basla_emotion_analysis/api.py
1.37 kB
| import requests | |
| import json | |
| from datetime import date, datetime, timedelta | |
| import os | |
| from typing import Optional, Dict, Union, List | |
| def health_check_request(toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'): | |
| """ | |
| "Hello World!" | |
| """ | |
| url = f"https://basla-emotion-analysis.p.rapidapi.com/" | |
| querystring = {} | |
| headers = { | |
| "X-RapidAPI-Key": toolbench_rapidapi_key, | |
| "X-RapidAPI-Host": "basla-emotion-analysis.p.rapidapi.com" | |
| } | |
| response = requests.get(url, headers=headers, params=querystring) | |
| try: | |
| observation = response.json() | |
| except: | |
| observation = response.text | |
| return observation | |
| def single_text_input_analysis(text: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'): | |
| """ | |
| "Insert your text to analyze Ekman emotion intensities." | |
| """ | |
| url = f"https://basla-emotion-analysis.p.rapidapi.com/ekman-predict-single/{text}" | |
| querystring = {} | |
| headers = { | |
| "X-RapidAPI-Key": toolbench_rapidapi_key, | |
| "X-RapidAPI-Host": "basla-emotion-analysis.p.rapidapi.com" | |
| } | |
| response = requests.get(url, headers=headers, params=querystring) | |
| try: | |
| observation = response.json() | |
| except: | |
| observation = response.text | |
| return observation | |