File size: 525 Bytes
143b783
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import polka from "polka";
import sirv from "sirv";
import path from "path";
import { dirname } from "path";
import { fileURLToPath } from "url";

const __dirname = dirname(fileURLToPath(import.meta.url));
const template = path.join(__dirname, "..", "gradio", "templates", "frontend");

export default async function global_setup() {
	const serve = sirv(template);
	const app = polka()
		.use(serve)
		.listen("9876", () => {
			console.log(`> Running on localhost: 9876`);
		});

	return () => {
		app.server.close();
	};
}