| 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) |