Download tool.py from flashdata-dev/youtube-license-metadata-flashdata: direct link, hf CLI and curl.
- Browser
- Download file 899 Bytes
-
https://huggingface.co/spaces/flashdata-dev/youtube-license-metadata-flashdata/resolve/main/tool.py
- Command line
-
hf download hf://spaces/flashdata-dev/youtube-license-metadata-flashdata/tool.py
-
curl -L -o tool.py https://huggingface.co/spaces/flashdata-dev/youtube-license-metadata-flashdata/resolve/main/tool.py
899 Bytes
| from smolagents import Tool | |
| class FlashDataTool(Tool): | |
| name = 'youtube_trainability' | |
| description = 'Inspect the Creative Commons license classification in YouTube video metadata. Return the license-label signal for a video ID. This checks license metadata, not creator training settings. It does not grant training, download or reuse permission. Uses paid FlashData API credits. Never automatically retry an uncertain submission; check Jobs first.' | |
| inputs = {'video_id': {'description': '11-character YouTube video ID or a YouTube video URL.', | |
| 'type': 'string'}} | |
| output_type = 'object' | |
| def forward(self, video_id: str) -> dict: | |
| from langchain_flashdata import FlashDataYouTubeTrainability | |
| values = {'video_id': video_id} | |
| return FlashDataYouTubeTrainability().invoke({key: value for key, value in values.items() if value is not None}) | |