Spaces:
Runtime error
Runtime error
Commit
•
261cd62
1
Parent(s):
96ba4ea
removing the code to exit nicely, as we cannot exist nicely
Browse files- public/README.md +0 -1
- src/index.mts +0 -14
public/README.md
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Put public file assets here.
|
|
|
|
src/index.mts
CHANGED
@@ -1,10 +1,6 @@
|
|
1 |
import express from 'express'
|
2 |
import { python } from 'pythonia'
|
3 |
|
4 |
-
// make it easier to import local Python modules (optional)
|
5 |
-
const sys = await python('sys')
|
6 |
-
await sys.path.insert(0, '.')
|
7 |
-
|
8 |
const { AutoModelForCausalLM } = await python('ctransformers')
|
9 |
const llm = await AutoModelForCausalLM.from_pretrained('marella/gpt-2-ggml')
|
10 |
|
@@ -20,14 +16,4 @@ app.get('/', async (req, res) => {
|
|
20 |
res.end()
|
21 |
})
|
22 |
|
23 |
-
process.on('SIGINT', () => {
|
24 |
-
try {
|
25 |
-
(python as any).exit()
|
26 |
-
} catch (err) {
|
27 |
-
// exiting Pythonia can get a bit messy: try/catch or not,
|
28 |
-
// you *will* see warnings and tracebacks in the console
|
29 |
-
}
|
30 |
-
process.exit(0)
|
31 |
-
})
|
32 |
-
|
33 |
app.listen(port, () => { console.log(`Open http://localhost:${port}`) })
|
|
|
1 |
import express from 'express'
|
2 |
import { python } from 'pythonia'
|
3 |
|
|
|
|
|
|
|
|
|
4 |
const { AutoModelForCausalLM } = await python('ctransformers')
|
5 |
const llm = await AutoModelForCausalLM.from_pretrained('marella/gpt-2-ggml')
|
6 |
|
|
|
16 |
res.end()
|
17 |
})
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
app.listen(port, () => { console.log(`Open http://localhost:${port}`) })
|