Last active
January 13, 2023 07:46
-
-
Save samrudh/c2ed7c4920425c82e92ed845d63f6811 to your computer and use it in GitHub Desktop.
integration of rasa model function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rasa.nlu.model import Interpreter | |
# path of your model | |
rasa_model_path = "<path-to-you-model-untar-directory>/nlu" | |
# create an interpreter object | |
interpreter = Interpreter.load(rasa_model_path) | |
""" | |
Function to get model output | |
Args: | |
text (string) -- input text string to be passed) | |
For example: if you are interested in entities, you can just write result['entities'] | |
Returns: | |
json -- json output to used for accessing model output | |
""" | |
def rasa_output(text): | |
message = str(text).strip() | |
result = interpreter.parse(message) | |
return result | |
rasa_output("<my-text-input-content-for-the-model>") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment