diff --git a/fastapi-rest-apis/actions/scripts/docSearch.py b/fastapi-rest-apis/actions/scripts/docSearch.py index 42e8479..66d955b 100644 --- a/fastapi-rest-apis/actions/scripts/docSearch.py +++ b/fastapi-rest-apis/actions/scripts/docSearch.py @@ -4,9 +4,8 @@ def find_occurrences(text, keyword): occurrences = text.lower().count(keyword.lower()) return occurrences -def get_output(): +def get_output(input_json): try: - input_json = json.loads(sys.argv[1]) text = input_json["text"] keyword = input_json["keyword"] num_occurrences = find_occurrences(text, keyword) diff --git a/fastapi-rest-apis/actions/scripts/generateImageFromText.py b/fastapi-rest-apis/actions/scripts/generateImageFromText.py index e8429b6..4157198 100644 --- a/fastapi-rest-apis/actions/scripts/generateImageFromText.py +++ b/fastapi-rest-apis/actions/scripts/generateImageFromText.py @@ -1,10 +1,10 @@ -def get_output(): +def get_output(input_json): try: import requests import json from craiyon import Craiyon generator = Craiyon() # Instantiates the api wrapper - result = generator.generate("Photorealistic image of shrek eating earth", negative_prompt="spoon", model_type="art") + result = generator.generate(input_json["prompt"], negative_prompt="spoon", model_type="art") print(json.dumps({"output": {"type": "text", "content": f"{result.description}"}})) except Exception as e: print(json.dumps({"output": {"type": "error", "content": e}})) diff --git a/fastapi-rest-apis/db/__pycache__/index.cpython-310.pyc b/fastapi-rest-apis/db/__pycache__/index.cpython-310.pyc index 86e2feb..09dff24 100644 Binary files a/fastapi-rest-apis/db/__pycache__/index.cpython-310.pyc and b/fastapi-rest-apis/db/__pycache__/index.cpython-310.pyc differ diff --git a/fastapi-rest-apis/db/index.py b/fastapi-rest-apis/db/index.py index e38b703..8eefb0a 100644 --- a/fastapi-rest-apis/db/index.py +++ b/fastapi-rest-apis/db/index.py @@ -5,6 +5,8 @@ DB_URL = os.environ['DB_URL'] + + def createDBSession(): engine = create_engine(DB_URL) Session = sessionmaker(bind=engine) diff --git a/fastapi-rest-apis/requirements.txt b/fastapi-rest-apis/requirements.txt index acafcd2..4d9e17f 100644 Binary files a/fastapi-rest-apis/requirements.txt and b/fastapi-rest-apis/requirements.txt differ