Skip to content

Commit

Permalink
fix paths and add cache for images
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelamsler committed Sep 17, 2022
1 parent 901f9b4 commit f64a129
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Empty file removed backend/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions backend/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion backend/test/prompt_extractor_test.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down

0 comments on commit f64a129

Please sign in to comment.