File size: 556 Bytes
e460bb5
c1548d4
e460bb5
c1548d4
71ad11e
e460bb5
 
71ad11e
e460bb5
a91e5a1
71ad11e
5f28fdf
c1548d4
 
 
 
a44175d
c1548d4
 
 
 
4238098
c1548d4
 
 
 
 
 
4238098
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
import google.generativeai as palm
import gradio as gr
import os 
import json

# Set your API key
palm.configure(api_key=os.environ['PALM_KEY'])

# Select the PaLM 2 model
# model = 'models/text-bison-001'


def responsenew(data):
    response = palm.chat(messages=data)
    respo = {
        "message": response.last,
        "action": "show_friends",
        "function": "nothing"
    }
    print(data)
    return json.dumps(respo)

gradio_interface = gr.Interface(
  fn = responsenew,
  inputs = "text",
  outputs = "text" 
)
gradio_interface.launch()