Download API.py from EdenSw/Vid2Sum: direct link, hf CLI and curl.
- Browser
- Download file 553 Bytes
-
https://huggingface.co/EdenSw/Vid2Sum/resolve/main/API.py
- Command line
-
hf download hf://EdenSw/Vid2Sum/API.py
-
curl -L -o API.py https://huggingface.co/EdenSw/Vid2Sum/resolve/main/API.py
553 Bytes
| import requests | |
| A2T_URL = "https://api-inference.huggingface.co/models/openai/whisper-large-v2" | |
| SUM_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-cnn" | |
| headers = {"Authorization": "Bearer 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"} | |
| def aud2text(filename): | |
| with open(filename, "rb") as f: | |
| data = f.read() | |
| response = requests.post(A2T_URL, headers=headers, data=data) | |
| return response.json() | |
| def Summarize(payload): | |
| response = requests.post(SUM_URL, headers=headers, json=payload) | |
| return response.json() |