Skip to content

Commit

Permalink
trying make deploy work
Browse files Browse the repository at this point in the history
  • Loading branch information
raibove committed May 2, 2024
1 parent c51eaca commit 9631ee3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
4 changes: 1 addition & 3 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
VITE_MODEL_NAME="gemini-1.0-pro-vision-latest"
VITE_API_KEY=""
VITE_COMPLEMENT_OUTFIT_MODEL="gemini-1.5-pro-latest"
VITE_API_KEY=""
2 changes: 2 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
push:
branches:
- main
env:
VITE_API_KEY: ${{ secrets.VITE_API_KEY }}
jobs:
build_and_deploy:
runs-on: ubuntu-latest
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on PR
on: pull_request
permissions:
checks: write
contents: read
pull-requests: write
jobs:
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_FABIFY_FASHION }}
projectId: fabify-fashion
#name: Deploy to Firebase Hosting on PR
#on: pull_request
#permissions:
# checks: write
# contents: read
# pull-requests: write
#jobs:
# build_and_preview:
# if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - run: npm ci && npm run build
# - uses: FirebaseExtended/action-hosting-deploy@v0
# with:
# repoToken: ${{ secrets.GITHUB_TOKEN }}
# firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_FABIFY_FASHION }}
# projectId: fabify-fashion
7 changes: 5 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

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

const OUTFIT_MODEL_NAME = "gemini-1.0-pro-vision-latest"
const COMPLEMENT_OUTFIT_MODEL="gemini-1.5-pro-latest"

export const processBase64 = (base64: string) => {
if (base64.split(',').length > 0) {
return base64.split(',')[1]
Expand Down Expand Up @@ -43,7 +46,7 @@ const loadImageAsBuffer = async (imageUrl: string): Promise<string> => {
export async function run(input: string) {

const genAI = new GoogleGenerativeAI(import.meta.env.VITE_API_KEY);
const model = genAI.getGenerativeModel({ model: import.meta.env.VITE_MODEL_NAME });
const model = genAI.getGenerativeModel({ model: OUTFIT_MODEL_NAME });

const base64Image0 = await loadImageAsBuffer('./image0.png');
const base64Image1 = await loadImageAsBuffer('./image1.png');
Expand Down Expand Up @@ -251,7 +254,7 @@ export const parseClothingData = (input: string): Clothing[] => {

export async function getComplementOutfit(input: Clothing) {
const genAI = new GoogleGenerativeAI(import.meta.env.VITE_API_KEY);
const model = genAI.getGenerativeModel({ model: import.meta.env.VITE_COMPLEMENT_OUTFIT_MODEL });
const model = genAI.getGenerativeModel({ model: COMPLEMENT_OUTFIT_MODEL });

const generationConfig = {
temperature: 1,
Expand Down

0 comments on commit 9631ee3

Please sign in to comment.