An example repository to use Google Gemini API to summarize text. Google Cloud credits are provided for this project, thanks GCP :).
There are two ways to run this demo app, one as a CLI to quickly test and another one as an API.
To use this sumamrizer (only avaiable in the command line for now), do the following:
- Clone the repository with
git clone [email protected]:geshan/summarizer-gemini.git
- Go to the directory with
cd summarizer-gemini
the runnpm install
- Log in to your GCP Console with
gcloud auth application-default login
- Make sure your Vertext API is enabled in the project you want to use it. You can try this URL to play around: https://console.cloud.google.com/vertex-ai/generative/language/create/text
- After that run
GCP_PROJECT=<your-project-id> GCP_LOCATION=<gcp-location> node --no-warnings cli.js <your-url>
as an exampleGCP_PROJECT=gemini-try-414805 GCP_LOCATION=us-central1 node --no-warnings cli.js https://jobs.lever.co/tyro/48a12893-c1a2-4a42-afa4-bc7fb6f572e5
- It will print out a summary on the CLI if everything went fine, like below:
To use the summarize as an API, you can do the following after doing steps 1-4 in the above section:
- Run
GCP_PROJECT=<your-project-id> GCP_LOCATION=<gcp-location> npm start
where the project id and location is needed as the above example. - On your browser of choice hit
http://localhost:3000/summary?url=https://myrepublica.nagariknetwork.com/news/kathmandu-ranks-fourth-among-world-s-most-polluted-cities/
you should get a summary as follows: