JavaScript and TypeScript client library for interacting with Gradio APIs, providing methods to connect to, submit predictions to, and manage connections with Gradio applications.
Overall
score
96%
Build a command-line tool that uses a Gradio application to analyze the sentiment of text input. The tool should connect to a Gradio sentiment analysis API and return the predicted sentiment along with confidence scores.
Your tool should:
The tool should be invocable as follows:
node sentiment-cli.js <gradio-url> <text>For example:
node sentiment-cli.js "https://example-sentiment.hf.space" "I love this product!"The tool should output the sentiment prediction result. For example:
Sentiment: positive
Confidence: 0.95@generates
/**
* Connects to a Gradio application and makes a sentiment prediction
* @param {string} gradioUrl - The URL of the Gradio application
* @param {string} text - The text to analyze
* @returns {Promise<Object>} The prediction result with sentiment and confidence
*/
async function analyzeSentiment(gradioUrl, text) {
// IMPLEMENTATION HERE
}
module.exports = { analyzeSentiment };Provides client library for interacting with Gradio applications.
Install with Tessl CLI
npx tessl i tessl/npm-gradio--clientevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10