diff --git a/.gitignore b/.gitignore index a22f2e9..def66b3 100644 --- a/.gitignore +++ b/.gitignore @@ -129,3 +129,5 @@ dmypy.json # Pyre type checker .pyre/ +/backend/services/prompt_extractor.py.cache.db +/backend/services/stable_diffusion_consumer.py.cache.db diff --git a/backend/__init__.py b/backend/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/backend/main.py b/backend/main.py index 6c026ad..563f01d 100755 --- a/backend/main.py +++ b/backend/main.py @@ -4,7 +4,7 @@ from os import path from typing import Dict -from backend.services.prompt_extractor import PromptExtractor +from services.prompt_extractor import PromptExtractor from fetch_images import fetch_image test_str = "There was a miller whose only inheritance to his three sons was his mill, his donkey, and his cat. The division was soon made. They hired neither a clerk nor an attorney, for they would have eaten up all the poor patrimony. The eldest took the mill, the second the donkey, and the youngest nothing but the cat. + oil painting" diff --git a/backend/serve.py b/backend/serve.py index 4d4c794..410832d 100644 --- a/backend/serve.py +++ b/backend/serve.py @@ -28,9 +28,9 @@ async def root(): @app.post("/imageFromPromt") -async def image_from_promt(payload: PromptPayload) -> StreamingResponse: +def image_from_promt(payload: PromptPayload) -> StreamingResponse: consumer = StableDiffusionConsumer() - image_bytes = next(consumer.fetch_image(payload.prompt)) + image_bytes = consumer.fetch_image(payload.prompt) return StreamingResponse(consumer.parse_to_bytesio(image_bytes), media_type="image/png") diff --git a/backend/test/prompt_extractor_test.py b/backend/test/prompt_extractor_test.py index 274d47a..0849dbd 100644 --- a/backend/test/prompt_extractor_test.py +++ b/backend/test/prompt_extractor_test.py @@ -1,7 +1,7 @@ import unittest from os import path -from backend.services.prompt_extractor import PromptExtractor +from services.prompt_extractor import PromptExtractor class MyTestCase(unittest.TestCase):