Spaces:
Sleeping
Sleeping
Commit
·
c591102
1
Parent(s):
9a9163b
Readme update
Browse files
README.md
CHANGED
|
@@ -10,4 +10,75 @@ pinned: false
|
|
| 10 |
hf_oauth: true
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
hf_oauth: true
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# Database structure
|
| 14 |
+
2 main endpoints: Videos and video_captions.
|
| 15 |
+
|
| 16 |
+
### Videos
|
| 17 |
+
Contains a json object with YouTube links to the videos.
|
| 18 |
+
|
| 19 |
+
Example entry:
|
| 20 |
+
```
|
| 21 |
+
0: "https://www.youtube.com/watch?v=tkMg8g8vVUo"
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
Keys are `integers`.
|
| 25 |
+
They define the order in which the videos show up on the page.
|
| 26 |
+
Keys must start with zero and have no gaps.
|
| 27 |
+
|
| 28 |
+
Values are video link `strings`.
|
| 29 |
+
Format is flexible, can optionally include `https://` or a query string.
|
| 30 |
+
|
| 31 |
+
All data is read only.
|
| 32 |
+
Editing/uploading new entries requires changing access rules.
|
| 33 |
+
|
| 34 |
+
### video_captions
|
| 35 |
+
Contains a json object with video information, namely captions.
|
| 36 |
+
|
| 37 |
+
Example entry:
|
| 38 |
+
```
|
| 39 |
+
tkMg8g8vVUo:
|
| 40 |
+
captions:
|
| 41 |
+
0:
|
| 42 |
+
start_time: 0
|
| 43 |
+
text: "text" # first caption line
|
| 44 |
+
end_time: 1
|
| 45 |
+
1:
|
| 46 |
+
start_time: 1
|
| 47 |
+
text: "text 2" # second caption line
|
| 48 |
+
end_time: 1.5
|
| 49 |
+
username: "user" # user who last edited captions
|
| 50 |
+
signer: 1 # (optional) signer in the video
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
Keys are video id `strings`.
|
| 54 |
+
|
| 55 |
+
Contains a json object. All keys are optional.
|
| 56 |
+
Relevant endpoints are `captions` and `username`, although any number of other objects can be added.
|
| 57 |
+
|
| 58 |
+
`captions` contains a json object with the captions to the video.
|
| 59 |
+
Keys are `integers`.
|
| 60 |
+
Values are json objects with `start_time`, `text` and `end_time` endpoints.
|
| 61 |
+
All keys are mandatory.
|
| 62 |
+
`start_time` and `end_time` must have a numeric value type.
|
| 63 |
+
`text` is a string.
|
| 64 |
+
|
| 65 |
+
`username` contains a `string` value.
|
| 66 |
+
It is the HuggingFace username of the person who last edited/saved captions for this video.
|
| 67 |
+
|
| 68 |
+
By default, data is read only.
|
| 69 |
+
The `username` endpoint is writable.
|
| 70 |
+
The `captions` endpoint is writable, as long as:
|
| 71 |
+
- written data has children
|
| 72 |
+
- all children have the required `start_time`, `text` and `end_time` children
|
| 73 |
+
- `start_time` and `end_time` are numeric
|
| 74 |
+
|
| 75 |
+
# Database connection
|
| 76 |
+
|
| 77 |
+
Connecting a Space to the database:
|
| 78 |
+
- Go to `Firebase` > `Project settings` > `General` > `Your apps` > `Caption_editor`
|
| 79 |
+
- In "SDK setup and configuration" select `Config`
|
| 80 |
+
- Copy only the config object value
|
| 81 |
+
- Go to space `Settings` > `Variables and secrets` > `Secrets` > `New secret`
|
| 82 |
+
- Add a secret with the name `FIREBASE_CONFIG` and value of the config object copied previously.
|
| 83 |
+
Note that it must be a valid json object, so the key names must be in double quotes.
|
| 84 |
+
- Done!
|