File size: 604 Bytes
d2f74fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from gradio_client import Client
import json

messages = json.dumps([{"role":"user","content":"hi(from macbook)"}])
#
args = json.dumps({"api_key":"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",
                   "base_url":"https://api.openai.com/v1",
                   "model":"gpt-3.5-turbo",
                   "temperature":"1.0",
                   "max_tokens":"1024" })


client = Client("https://f2569cc8b84a4386fa.gradio.live/")
result = client.predict(
		messages,	# str  in 'Input' Textbox component
		args,	# str  in 'Args' Textbox component
		api_name="/submit"
)
print(result)