User: Admin: Difference between revisions
From ElixirBlocks
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
How to Create Database Seed Data. | |||
How to Use Generators in a Real World Project | |||
How to Work with Database Data via Basic Commands and Custom Change sets. | |||
How to Render Database Data to LiveView (via Context Commands). | |||
How to Create a Chat using PubSub. | |||
How to Create Event Handlers in LiveView | |||
How to Create a Dynamic Route from Scratch. | |||
How to Use Elixirs Template language | |||
How to Work with Modal | |||
How to Use CSS From Scratch (Without bundler) | |||
How to use JS hooks | |||
<source> | <source> | ||
Revision as of 02:37, 5 July 2023
How to Create Database Seed Data. How to Use Generators in a Real World Project How to Work with Database Data via Basic Commands and Custom Change sets. How to Render Database Data to LiveView (via Context Commands). How to Create a Chat using PubSub. How to Create Event Handlers in LiveView How to Create a Dynamic Route from Scratch. How to Use Elixirs Template language How to Work with Modal How to Use CSS From Scratch (Without bundler) How to use JS hooks
import {HfInference} from "@huggingface/inference";
import dotenv from "dotenv";
dotenv.config()
const HF_ACCESS_TOKEN = process.env.HF_ACCESS_TOKEN
const hf = new HfInference(HF_ACCESS_TOKEN);
/*______Uncomment for this example______________________
const model = "nlpconnect/vit-gpt2-image-captioning";
const imageURL = "https://i.imgur.com/lTvb7Et.png";
const response = await fetch(imageURL);
const imageBlob = await response.blob();
const result = await hf.imageToText({
data: imageBlob,
model: model,
});
_______________________________________________________*/
/*________Another example ___________________*/
const result = await hf.summarization({
model: 'facebook/bart-large-cnn',
inputs: "The role of a dumb man is to get smarter oogy bookie boo",
parameters:{
max_length: 100
}
});
console.log(result);
________________________________________
https://fly.io/phoenix-files/sdeb-toggling-element/
https://www.youtube.com/watch?v=vBgZvQapqhs
https://blog.testdouble.com/posts/2022-11-28-how-to-use-javascript-with-phoenix-liveview/