Grilled Cheese

ExploreLog inSign up
PhotosVideosAllPeople
LatestRanked
@armenvardanyan.devOct 12, 2026, 11:59 AM

Did you know that Chrome (experimental) ships with a Gemini Nano model inside?

This is all a bit raw for now, but I see things like this as the future of on-device AI

Anyway here is an Angular directive that detects spam comments 😆

#Angular #GeminiNano #ChromeAI #OnDeviceAI #WebDev

@Directive({
  selector: '[spamCheck]',
  host: { '[title]': 'spam.value() ? "Potential spam" : null' },
})
export class SpamCheck {
  text = input.required<string>({ alias: 'spamCheck' });

  spam = resource({
    params: () => this.text(),
    loader: async ({ params }) => {
      const ai = await LanguageModel.create();
      const answer = await ai.prompt(`Is this spam?\n\n${params}`, {
        responseConstraint: { type: 'boolean' },
      });
      return JSON.parse(answer);
    },
  });
}

// comments.html
@for (c of comments(); track c.id) {
  <p [spamCheck]="c.text">{{ c.text }}</p>
}
Terms of UsePrivacy PolicyCommunity StandardsHelpGet the app

Grilled Cheese is a product of Village Compute

Version devBuilt at: 2026-10-15 19:58:26 EDT