Khrisna commited on
Commit
4d1acd2
·
verified ·
1 Parent(s): 180e271

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +12 -15
index.js CHANGED
@@ -133,22 +133,19 @@ async function processImage2Img(imgBuffer, prompt) {
133
 
134
  async function chatgpt4(prompt) {
135
  try {
136
- process.env.GRADIO_CLIENT_DEBUG = 'true';
137
-
138
- const client = await Client.connect("KingNish/OpenGPT-4o");
139
- const audioBuffer = Buffer.alloc(0)
140
- const result = await client.predict("/chat", {
141
- user_prompt: {"text": prompt, "files": [], "audio": audioBuffer}, // Add audio parameter
142
- model_selector: "idefics2-8b-chatty",
143
- decoding_strategy: "Greedy",
144
- temperature: 0,
145
- max_new_tokens: 2048,
146
- repetition_penalty: 0.01,
147
- top_p: 0.01,
148
- web_search: true,
149
  });
150
  return result.data;
151
- } catch(e) {
152
- return e.message;
 
153
  }
154
  }
 
133
 
134
  async function chatgpt4(prompt) {
135
  try {
136
+ const client = await Client.connect("KingNish/OpenGPT-4o", { debug: true });
137
+ const result = await client.predict("/chat", {
138
+ user_prompt: { text: prompt },
139
+ decoding_strategy: "Greedy",
140
+ temperature: 0,
141
+ max_new_tokens: 2048,
142
+ repetition_penalty: 0.01,
143
+ top_p: 0.01,
144
+ web_search: true,
 
 
 
 
145
  });
146
  return result.data;
147
+ } catch (error) {
148
+ console.error(error);
149
+ throw error; // Rethrow the error to allow for better error handling
150
  }
151
  }