Emalawi19 commited on
Commit
5171cc2
·
verified ·
1 Parent(s): d5edfd7

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +4 -4
server.js CHANGED
@@ -3,7 +3,7 @@ import http from 'http';
3
 
4
  // Configuration
5
  const PORT = 7860;
6
- const MODEL_NAME = 'Xenova/codegen-2B-mono'; // ← Upgraded: 2B param model, much stronger code generation
7
  let generator;
8
 
9
  // Initialize the model on startup
@@ -18,7 +18,7 @@ const server = http.createServer(async (req, res) => {
18
  res.setHeader('Access-Control-Allow-Origin', '*');
19
  res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
20
  res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
21
-
22
  // Handle preflight requests for the API
23
  if (req.method === 'OPTIONS') {
24
  res.writeHead(200);
@@ -49,9 +49,9 @@ const server = http.createServer(async (req, res) => {
49
  return res.end(JSON.stringify({ error: "Model is still loading..." }));
50
  }
51
  // Generate code based on the prompt
52
- const output = await generator(prompt, {
53
  max_new_tokens: 100,
54
- temperature: 0.7
55
  });
56
  res.writeHead(200);
57
  res.end(JSON.stringify({ result: output[0].generated_text }));
 
3
 
4
  // Configuration
5
  const PORT = 7860;
6
+ const MODEL_NAME = 'Xenova/starcoderbase-1b'; // ← 1B param, public, strong code generation
7
  let generator;
8
 
9
  // Initialize the model on startup
 
18
  res.setHeader('Access-Control-Allow-Origin', '*');
19
  res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
20
  res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
21
+
22
  // Handle preflight requests for the API
23
  if (req.method === 'OPTIONS') {
24
  res.writeHead(200);
 
49
  return res.end(JSON.stringify({ error: "Model is still loading..." }));
50
  }
51
  // Generate code based on the prompt
52
+ const output = await generator(prompt, {
53
  max_new_tokens: 100,
54
+ temperature: 0.7
55
  });
56
  res.writeHead(200);
57
  res.end(JSON.stringify({ result: output[0].generated_text }));