переделай с учетом данных по вызову API: 1. Install the javascript client (docs) if you don't already have it installed.
$ npm i -D @gradio/client
- Find the API endpoint below corresponding to your desired function in the app. Copy the code snippet, replacing the placeholder values with your own input data. If this is a private Space, you may need to pass your Hugging Face token as well (read more). Or use the
to automatically generate your API requests.
api_name: /enable_inputs
import { Client } from "@gradio/client";
const client = await Client.connect("yuntian-deng/ChatGPT4");
const result = await client.predict("/enable_inputs", {
});
console.log(result.data);
Accepts 0 parameters:
Returns 1 element
api_name: /reset_textbox
import { Client } from "@gradio/client";
const client = await Client.connect("yuntian-deng/ChatGPT4");
const result = await client.predict("/reset_textbox", {
});
console.log(result.data);
Accepts 0 parameters:
Returns 1 element
string
The output value that appears in the "Type an input and press Enter" Textbox component.
api_name: /predict
import { Client } from "@gradio/client";
const client = await Client.connect("yuntian-deng/ChatGPT4");
const result = await client.predict("/predict", {
inputs: "Hello!!",
top_p: 0,
temperature: 0,
chat_counter: 3,
chatbot: [["Hello!",None]],
});
console.log(result.data);
Accepts 5 parameters:
inputs string Required
The input value that is provided in the "Type an input and press Enter" Textbox component.
top_p number Default: 1
The input value that is provided in the "Top-p (nucleus sampling)" Slider component.
temperature number Default: 1
The input value that is provided in the "Temperature" Slider component.
chat_counter number Default: 0
The input value that is provided in the "parameter_16" Number component.
chatbot any Default: []
The input value that is provided in the "parameter_4" Chatbot component.
Returns list of 4 elements
[0]
The output value that appears in the "value_4" Chatbot component.
[1] number
The output value that appears in the "value_16" Number component.
[2] string
The output value that appears in the "Status code from OpenAI server" Textbox component.
[3] string
The output value that appears in the "Type an input and press Enter" Textbox component.
api_name: /reset_textbox_1
import { Client } from "@gradio/client";
const client = await Client.connect("yuntian-deng/ChatGPT4");
const result = await client.predict("/reset_textbox_1", {
});
console.log(result.data);
Accepts 0 parameters:
Returns 1 element
string
The output value that appears in the "Type an input and press Enter" Textbox component.
api_name: /predict_1
import { Client } from "@gradio/client";
const client = await Client.connect("yuntian-deng/ChatGPT4");
const result = await client.predict("/predict_1", {
inputs: "Hello!!",
top_p: 0,
temperature: 0,
chat_counter: 3,
chatbot: [["Hello!",None]],
});
console.log(result.data);
Accepts 5 parameters:
inputs string Required
The input value that is provided in the "Type an input and press Enter" Textbox component.
top_p number Default: 1
The input value that is provided in the "Top-p (nucleus sampling)" Slider component.
temperature number Default: 1
The input value that is provided in the "Temperature" Slider component.
chat_counter number Default: 0
The input value that is provided in the "parameter_16" Number component.
chatbot any Default: []
The input value that is provided in the "parameter_4" Chatbot component.
Returns list of 4 elements
[0]
The output value that appears in the "value_4" Chatbot component.
[1] number
The output value that appears in the "value_16" Number component.
[2] string
The output value that appears in the "Status code from OpenAI server" Textbox component.
[3] string
The output value that appears in the "Type an input and press Enter" Textbox component.