Spaces:
Paused
Paused
Download src/getVideoPrompt.mts from jbilcke-hf/media-server: direct link, hf CLI and curl.
- Browser
- Download file 718 Bytes
-
https://huggingface.co/spaces/jbilcke-hf/media-server/resolve/main/src/getVideoPrompt.mts
- Command line
-
hf download hf://spaces/jbilcke-hf/media-server/src/getVideoPrompt.mts
-
curl -L -o getVideoPrompt.mts https://huggingface.co/spaces/jbilcke-hf/media-server/resolve/main/src/getVideoPrompt.mts
718 Bytes
| /* | |
| import { HfInference } from '@huggingface/inference' | |
| const hf = new HfInference(process.env.WEBTV_HF_API_TOKEN) | |
| const model = 'OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5' | |
| export const getVideoPrompt = async (seed: string) => { | |
| const inputs = `<|prompter|>Can you propose a caption for a new video, that we could display after the first one? Here's the caption for the first video: "${seed}"<|endoftext|><|assistant|>The best caption would be:` | |
| const { generated_text } = await hf.textGeneration({ | |
| model, | |
| inputs, | |
| parameters: { | |
| max_new_tokens: 50, | |
| return_full_text: false, | |
| // temperature: 0.3, | |
| } | |
| }) | |
| return generated_text.split(/[#\[\]]/)[0].replace('"', '') | |
| } | |
| */ | |