Label-studio: cors problem while labeling

Created on 3 Jun 2021  路  3Comments  路  Source: heartexlabs/label-studio

I have started the server,created a account,and imported my data by a .txt file,but when i start to label my data,i get an error below.I just don't know why i have imported my data but get an error like this while labeling.And my .txt file is below,i start LS by 'label-studio',data server by 'python -m http.server 8081 -d'.

cors problem:
image

.txt file:
image

data server console error:
image
It says an existing connection was forcibly closed by the remote host.

need recipes

Most helpful comment

Starting python simple http module will not allow CORS. Use following script to start a simple http server with CORS enabled
https://stackoverflow.com/questions/21956683/enable-access-control-on-simple-http-server
```#!/usr/bin/env python3
from http.server import HTTPServer, SimpleHTTPRequestHandler, test
import sys

class CORSRequestHandler (SimpleHTTPRequestHandler):
def end_headers (self):
self.send_header('Access-Control-Allow-Origin', '*')
SimpleHTTPRequestHandler.end_headers(self)

if __name__ == '__main__':
test(CORSRequestHandler, HTTPServer, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8```

All 3 comments

Starting python simple http module will not allow CORS. Use following script to start a simple http server with CORS enabled
https://stackoverflow.com/questions/21956683/enable-access-control-on-simple-http-server
```#!/usr/bin/env python3
from http.server import HTTPServer, SimpleHTTPRequestHandler, test
import sys

class CORSRequestHandler (SimpleHTTPRequestHandler):
def end_headers (self):
self.send_header('Access-Control-Allow-Origin', '*')
SimpleHTTPRequestHandler.end_headers(self)

if __name__ == '__main__':
test(CORSRequestHandler, HTTPServer, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8```

That's great! Also there is an even simpler method mentioned in this stackoverflow thread, without creating any line of code:

npm install http-server -g
http-server -p 3000 --cors

@kaitco @niklub I have tried锛宐oth of them are working锛宼hank you.

Was this page helpful?
0 / 5 - 0 ratings