Skip to content

Commit 05a3a7c

Browse files
committed
formatting
1 parent dd80764 commit 05a3a7c

File tree

4 files changed

+17
-36
lines changed

4 files changed

+17
-36
lines changed

extensions/firestore-huggingface-inference-api/POSTINSTALL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ You can test out this extension right away!
55
Depending on the task you want to run, add a new Firestore document to `${param:collectionPath}`.
66

77
For example, if you want to run a text classification task using the model [`distilbert-base-uncased-finetuned-sst-2-english`](https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english), add a new document to `${param:collectionPath}` with the following fields:
8+
89
```
910
{
1011
"inputs": "You're amazing!"
Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Trigger Hugging Face inference API from Firestore
22

3-
**Author**: undefined
4-
5-
**Description**: This extension triggers the Hugging Face inference API when a new document is created in a Firestore collection.
6-
3+
**Author**: undefined
74

5+
**Description**: This extension triggers the Hugging Face inference API when a new document is created in a Firestore collection.
86

97
**Details**: Use this extension to run inferences in a Firestore collection using the [Hugging Face inference API](https://huggingface.co/docs/api-inference).
108

@@ -25,39 +23,30 @@ This extension uses other Firebase or Google Cloud Platform services which may h
2523

2624
When you use Firebase Extensions, you're only charged for the underlying resources that you use. A paid-tier billing plan is only required if the extension uses a service that requires a paid-tier plan, for example calling to a Google Cloud Platform API or making outbound network requests to non-Google services. All Firebase services offer a free tier of usage. [Learn more about Firebase billing.](https://firebase.google.com/pricing)
2725

28-
29-
30-
3126
**Configuration Parameters:**
3227

33-
* Hugging Face Access Token: You can find your API token on your [Hugging Face account page](https://huggingface.co/settings/token).
34-
From Hugging Face docs:
35-
You should see a token hf_xxxxx (old tokens are api_XXXXXXXX or api_org_XXXXXXX).
36-
If you do not submit your API token when sending requests to the API, you will not be able to run inference on your private models.
37-
38-
* Model ID: The Model ID from [Hugging Face Model Hub](https://huggingface.co/models).
39-
Check the [recommended models for each ML task available](https://api-inference.huggingface.co/docs/python/html/detailed_parameters.html#detailed-parameters), or the [Tasks](https://huggingface.co/tasks) overview.
28+
- Hugging Face Access Token: You can find your API token on your [Hugging Face account page](https://huggingface.co/settings/token).
29+
From Hugging Face docs:
30+
You should see a token hf_xxxxx (old tokens are api_XXXXXXXX or api_org_XXXXXXX).
31+
If you do not submit your API token when sending requests to the API, you will not be able to run inference on your private models.
4032

41-
* Inference Collection Path: New inferences using the HuggingFace Inference API can be made by easily adding a new document to this collection path.
33+
- Model ID: The Model ID from [Hugging Face Model Hub](https://huggingface.co/models).
34+
Check the [recommended models for each ML task available](https://api-inference.huggingface.co/docs/python/html/detailed_parameters.html#detailed-parameters), or the [Tasks](https://huggingface.co/tasks) overview.
4235

43-
* The task to run the inference on: The task to run the inference on. [Check more in the Hugging Face docs](https://huggingface.co/docs/api-inference/detailed_parameters), or the [Tasks](https://huggingface.co/tasks) overview.
36+
- Inference Collection Path: New inferences using the HuggingFace Inference API can be made by easily adding a new document to this collection path.
4437

45-
* Custom Inference Endpoint: If you want to use a custom model hosted on your own server, you can specify the endpoint here.
46-
47-
* Cloud Functions location: Where do you want to deploy the functions created for this extension? For help selecting a location, refer to the [location selection guide](https://firebase.google.com/docs/functions/locations).
38+
- The task to run the inference on: The task to run the inference on. [Check more in the Hugging Face docs](https://huggingface.co/docs/api-inference/detailed_parameters), or the [Tasks](https://huggingface.co/tasks) overview.
4839

40+
- Custom Inference Endpoint: If you want to use a custom model hosted on your own server, you can specify the endpoint here.
4941

42+
- Cloud Functions location: Where do you want to deploy the functions created for this extension? For help selecting a location, refer to the [location selection guide](https://firebase.google.com/docs/functions/locations).
5043

5144
**Cloud Functions:**
5245

53-
* **triggerInference:** Firestore onCreate-triggered function that run an inference on ${param:MODEL_ID} when a new document is created in the collection ${param:COLLECTION_PATH}
54-
55-
46+
- **triggerInference:** Firestore onCreate-triggered function that run an inference on ${param:MODEL_ID} when a new document is created in the collection ${param:COLLECTION_PATH}
5647

5748
**Access Required**:
5849

59-
60-
6150
This extension will operate with the following project IAM roles:
6251

63-
* datastore.user (Reason: This role is required to read/write from the Cloud Firestore database.)
52+
- datastore.user (Reason: This role is required to read/write from the Cloud Firestore database.)

extensions/firestore-huggingface-inference-api/extension.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,13 @@ roles:
2727
reason: This role is required to read/write from the Cloud Firestore database.
2828

2929
resources:
30-
# - name: runInference
31-
# type: firebaseextensions.v1beta.function
32-
# description: >-
33-
# HTTP call-triggered function that run an inference on ${params:MODEL_ID}
34-
# properties:
35-
# location: ${LOCATION}
36-
# runtime: 'nodejs16'
37-
# httpsTrigger: {}
38-
3930
- name: triggerInference
4031
type: firebaseextensions.v1beta.function
4132
description: >-
4233
Firestore onCreate-triggered function that run an inference on ${param:MODEL_ID} when a new
4334
document is created in the collection ${param:COLLECTION_PATH}
4435
properties:
45-
location: ${LOCATION}
36+
location: ${param:LOCATION}
4637
runtime: 'nodejs18'
4738
eventTrigger:
4839
eventType: providers/cloud.firestore/eventTypes/document.write

extensions/firestore-huggingface-inference-api/functions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
"typescript": "^4.9.0"
3131
},
3232
"private": true
33-
}
33+
}

0 commit comments

Comments
 (0)