Skip to content

Commit

Permalink
PWA support
Browse files Browse the repository at this point in the history
  • Loading branch information
Chiroyce1 committed Sep 8, 2024
1 parent b6eb2d5 commit 418ffdb
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 5 deletions.
Binary file removed images/github.png
Binary file not shown.
9 changes: 5 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="./images/gemini.png" type="image/png">
<meta name="description" content="A demo of Google's latest vision based AI model, gemini-pro-vision.">
<meta name="description" content="A demo of Google's latest multimodal AI, gemini-1.5-flash">
<link rel="manifest" href="./manifest.json">
<meta name="keywords"
content="google, gemini, image-analysis, google-ai, gemini-pro-vision, gpt, chatgpt, ai, llm, gemini-demo, chiroyce">
content="google, gemini, image-analysis, gemini-flash, google-ai, gpt, chatgpt, ai, llm, gemini-demo, chiroyce">
<link rel="stylesheet" href="./style.css">
<script type="importmap">
{
Expand All @@ -17,12 +18,12 @@
}
</script>

<title>Gemini Pro Vision Demo</title>
<title>Gemini Vision</title>
</head>

<body>
<div class="stuff">
<h1>Gemini Pro Vision</h1>
<h1>Gemini Vision</h1>
<div class="flex">
<div class="right" id="settings">
<input type="password" id="api" placeholder="Enter API key (get it from ai.google.dev)">
Expand Down
15 changes: 15 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "Gemini Vision",
"short_name": "Gemini",
"display": "standalone",
"start_url": "./",
"icons": [
{
"src": "./images/gemini.png",
"type": "image/x-png",
"sizes": "500x500"
}
],
"background_color": "#588fec",
"theme_color": "#588fec"
}
26 changes: 25 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
import { GoogleGenerativeAI } from "@google/generative-ai";
import prompts from "./prompts.js";

import { HarmBlockThreshold, HarmCategory } from "@google/generative-ai";

const safetySettings = [
{
category: HarmCategory.HARM_CATEGORY_HARASSMENT,
threshold: HarmBlockThreshold.BLOCK_NONE,
},
{
category: HarmCategory.HARM_CATEGORY_HATE_SPEECH,
threshold: HarmBlockThreshold.BLOCK_NONE,
},
{
category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
threshold: HarmBlockThreshold.BLOCK_NONE,
},
{
category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
threshold: HarmBlockThreshold.BLOCK_NONE,
},
];

const responseElement = document.getElementById("response");
const cameraSelect = document.getElementById("cameraSelect");
const promptSelect = document.getElementById("promptSelect");
Expand Down Expand Up @@ -119,7 +140,10 @@ async function captureImage() {
show(`Oops something went wrong.\nError: ${e}`);
}

const model = genAI.getGenerativeModel({ model: "gemini-1.5-flash" });
const model = genAI.getGenerativeModel({
model: "gemini-1.5-flash",
safetySettings,
});
show("Loading... ");
let res;
active = true;
Expand Down

0 comments on commit 418ffdb

Please sign in to comment.