Spaces:
Running
Running
Update index.js
Browse files
index.js
CHANGED
@@ -133,22 +133,19 @@ async function processImage2Img(imgBuffer, prompt) {
|
|
133 |
|
134 |
async function chatgpt4(prompt) {
|
135 |
try {
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
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(
|
152 |
-
|
|
|
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 |
}
|