File size: 817 Bytes
d2a98b0
7f8afd8
1a73972
8cf57d7
7f8afd8
1a73972
 
7f8afd8
1a73972
7f8afd8
1a73972
 
 
 
 
 
 
7f8afd8
 
 
1a73972
 
 
 
 
 
 
 
 
 
 
7f8afd8
1a73972
 
7f8afd8
d2a98b0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import streamlit as st
from transformers import pipeline
# from langchain.llms import GooglePalm
import os

# #x = st.slider('Select a value')
# #st.write(x, 'squared is', x * x)

# #pipe = pipeline('sentiment-analysis')

# api_key = os.environ["GOOGLE_PALM_API_KEY"]
# llm = GooglePalm(google_api_key=api_key, temperature=0.1)

import google.generativeai as palm

google_api_key=os.getenv('GOOGLE_PALM_API_KEY')
palm.configure(api_key=google_api_key)

text = st.text_area('enter text to get assistance!')

#prompt = 'Explain the difference between effective and affective with examples'
prompt = text

completion = palm.generate_text(
    model='models/text-bison-001',
    prompt=prompt,
    temperature=0.1
)

#print(completion.result)

if text:
    #out = llm(text)
    out = completion.result;
    st.json(out)