from gradio_client import Client
client = Client("{root}")
result = client.predict({#each endpoint_parameters as { label, type, python_type, component, example_input, serializer }, i}
{represent_value(example_input, python_type.type, "py")},{#if dependency_failures[dependency_index][i]}ERROR{/if} # {python_type.type} {#if python_type.description}({python_type.description}){/if} in '{label}' {component} component{/each}
api_name="/{dependency.api_name}"
)
print(result)
{:else if current_language === "javascript"}
import { client } from "@gradio/client";
{#each blob_examples as { label, type, python_type, component, example_input, serializer }, i}
const response_{i} = await fetch("{example_input}");
const example{component} = await response_{i}.blob();
{/each}
const app = await client("{root}");
const result = await app.predict({#if named}"/{dependency.api_name}"{:else}{dependency_index}{/if}, [{#each endpoint_parameters as { label, type, python_type, component, example_input, serializer }, i}{#if blob_components.includes(component)}
example{component}, // blob in '{label}' {component} component{:else}
{represent_value(
example_input,
python_type.type,
"js"
)}, // {js_parameters[i]
.type} {#if js_parameters[i].description}({js_parameters[i]
.description}){/if} in '{label}' {component} component{/if}
{/each}
]);
console.log(result.data);
{/if}