Download scripts/fpn.py from killbill007/test111: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/killbill007/test111/resolve/main/scripts/fpn.py
- Command line
-
hf download hf://killbill007/test111/scripts/fpn.py
-
curl -L -o fpn.py https://huggingface.co/killbill007/test111/resolve/main/scripts/fpn.py
1.03 kB
| import firebase_admin | |
| from firebase_admin import credentials | |
| from firebase_admin import messaging | |
| cred = credentials.Certificate('./env/firebase/faceanimate-firebase-adminsdk-lnj8m-8fefd36f2f.json') | |
| default_app = firebase_admin.initialize_app(cred) | |
| class FCM: | |
| def __init__(self): | |
| pass | |
| def push_notification(title, body, image, topic='testTopic'): | |
| notification = messaging.Notification( | |
| title=title, | |
| body=body, | |
| image=image, | |
| ) | |
| message = messaging.Message( | |
| notification=notification, | |
| topic=topic, | |
| ) | |
| response = messaging.send(message) | |
| if response: | |
| return True | |
| return False | |
| def push_message_to_user(data, registration_token): | |
| message = messaging.Message( | |
| data=data, | |
| token=registration_token, | |
| ) | |
| response = messaging.send(message) | |
| if response: | |
| return True | |
| return False | |
| def __del__(self): | |
| pass |