This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.geminidemo; | |
import com.google.cloud.vertexai.VertexAI; | |
import com.google.cloud.vertexai.api.Content; | |
import com.google.cloud.vertexai.api.FunctionCall; | |
import com.google.cloud.vertexai.api.FunctionDeclaration; | |
import com.google.cloud.vertexai.api.GenerateContentResponse; | |
import com.google.cloud.vertexai.api.GenerationConfig; | |
import com.google.cloud.vertexai.api.HarmCategory; | |
import com.google.cloud.vertexai.api.SafetySetting; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gcfv2; | |
import java.io.BufferedWriter; | |
import com.google.gson.Gson; | |
import com.google.gson.JsonObject; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.util.stream.Collectors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>gcfv2</groupId> | |
<artifactId>http</artifactId> | |
<version>0.0.1</version> | |
<name>HTTP Function for Cloud Functions 2nd gen</name> | |
<properties> | |
<maven.compiler.target>11</maven.compiler.target> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>gcfv2</groupId> | |
<artifactId>http</artifactId> | |
<version>0.0.1</version> | |
<name>HTTP Function for Cloud Functions 2nd gen</name> | |
<properties> | |
<maven.compiler.target>11</maven.compiler.target> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gcfv2; | |
import java.io.BufferedWriter; | |
import com.google.gson.Gson; | |
import com.google.gson.JsonObject; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.util.stream.Collectors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import os | |
from google.cloud import logging | |
from typing import Mapping | |
import google.auth.transport.requests | |
import google.oauth2.id_token | |
import requests | |
import flask | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud functions deploy summarizeText \ | |
--gen2 \ | |
--runtime=python311 \ | |
--region=$GCP_REGION \ | |
--source=. \ | |
--entry-point=summarizeText \ | |
--trigger-http \ | |
--set-env-vars=GCP_PROJECT=$GCP_PROJECT,GCP_REGION=$GCP_REGION \ | |
--allow-unauthenticated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
import functions_framework | |
import google.cloud.logging | |
import vertexai | |
from vertexai.language_models import TextGenerationModel | |
PROJECT_ID = os.environ.get('GCP_PROJECT','-') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const browser = await puppeteer.launch({args: ['--no-sandbox']}); | |
const page = await browser.newPage(); | |
await page.goto("https://loveiscomix.com/random"); | |
let imageurl = await page.evaluate(() => { | |
let item = document.querySelector('#primary > main > article > div > div.cellcomic > a > img'); | |
return 'https://loveiscomix.com/' + item.getAttribute('src'); | |
}) | |
browser.close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let LoveIsComic_HTMLTemplate = ( | |
url | |
) => { | |
return ` | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Love Is Comic</title> | |
</head> | |
<body> |
NewerOlder