Error in endpoint with js

#2
by Observale - opened

when i'm trying to use the endpoint with the bellow code it returns this error

import { client } from "@gradio/client";
const gradioAppURL = "https://ysharma-nougat.hf.space/";

const PDFURL = await fetch("https://github.com/gradio-app/gradio/raw/main/test/test_files/sample_file.pdf");
const exampleFile = await PDFURL.blob();

// let app = await client("https://ysharma-nougat.hf.space");
// let result = await app.predict(0, [exampleFile]);

// Create an async function to interact with the Gradio app
async function interactWithGradioApp() {
try {
// Connect to the Gradio app
const app = await client(gradioAppURL);

  // Use the app to make predictions or perform actions
  const result = await app.predict(0, [exampleFile]);

  // Handle the result as needed
  console.log(result);
} catch (error) {
  // Handle any errors that may occur
  console.error("Error:", error);
}

}

// Call the function to interact with the Gradio app
interactWithGradioApp();

The error :
image.png

Sign up or log in to comment