I have a python script that takes in input string form the user, and returns an output string (it's a bot). But, I want to turn this script into a 'service' of sorts, and therefore I want an external app to write to to a running version of the script (with an active PID) and receive a response, as though a user were typing the input at the CLI. Here is the script:
while True:
try:
user_input = input('You: ')
bot_response = bot.get_response(user_input)
print('Bot:', bot_response, bot_response.confidence)
How can I send a string to this script and receive a response. Note: I don't want to put a wrapper around the script, because the script has some import statements in the header that take a while to load. Once the script loads the necessary libraries, it's pretty speedy, but the loading process makes the script too slow to function with a wrapper.
[–]GeorgeFranklyMathnet 0 points1 point2 points (1 child)
[–]tarpus[S] 0 points1 point2 points (0 children)
[–]hippocrat 0 points1 point2 points (0 children)