My use case is that I want to host prodigy though my hosted Debian instance so that I can classify data from iPad/phone.
After reading this forum, it seems other users are succesful at this but I haven't been able to achieve this.
As of right now, I have the following code:
run_server.wsgi
from start_server import run_prodigy_server
import start_server
start_server.py
import prodigy
import os
from common.config import app_root
model = 'ner.teach'
dataset_name = 'dataset_test'
json_file = 'news_headlines.jsonl'
labels = ['PERSON', 'ORG']
host = '0.0.0.0'
port = 8081
full_path = os.path.join(app_root(), *['ml', 'aiprodigy'], json_file)
prodigy.serve(model, dataset_name, 'en_core_web_sm', full_path, None, None, labels, None, port=port)
This is then run through Apache WSGI. However, I run into the following error in my logs:
mod_wsgi (pid=30165): Exception occurred processing WSGI script '/home/user/project/dev/ml/aiprodigy/run_server.wsgi'.
Traceback (most recent call last):
File "/home/user/project/dev/ml/aiprodigy/run_server.wsgi", line 7, in <module>
from start_server import run_prodigy_server
File "/home/user/project/dev/ml/aiprodigy/start_server.py", line 19, in <module>
None, None, labels, host=host, port=port)
File "/home/user/.local/lib/python3.7/site-packages/prodigy/__init__.py", line 46, in serve
server(controller, controller.config)
File "/home/user/.local/lib/python3.7/site-packages/prodigy/app.py", line 476, in server
log_config=_uvicorn_log_config,
File "/home/user/.local/lib/python3.7/site-packages/uvicorn/main.py", line 346, in run
server.run()
File "/home/user/.local/lib/python3.7/site-packages/uvicorn/main.py", line 374, in run
loop.run_until_complete(self.serve(sockets=sockets))
File "uvloop/loop.pyx", line 1450, in uvloop.loop.Loop.run_until_complete
File "uvloop/loop.pyx", line 1443, in uvloop.loop.Loop.run_until_complete
File "uvloop/loop.pyx", line 1351, in uvloop.loop.Loop.run_forever
File "uvloop/loop.pyx", line 497, in uvloop.loop.Loop._run
File "uvloop/loop.pyx", line 281, in uvloop.loop.Loop._setup_or_resume_signals
File "uvloop/loop.pyx", line 270, in uvloop.loop.Loop._setup_or_resume_signals
File "uvloop/loop.pyx", line 3238, in uvloop.loop._set_signal_wakeup_fd
ValueError: set_wakeup_fd only works in main thread
This might be due to the WSGI link in some way. Any clue how to fix this? Alternatively, is there a better method to host Prodigy (e.g. through ASGI)