Skip to content

revert tabels operations changes, optimize imports #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions image_app_session_credits/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ def post(prompt: str, session):
folder = f"data/gens/{str(uuid.uuid4())}"
os.makedirs(folder, exist_ok=True)
g = gens.insert(
Generation(prompt=prompt,
folder=folder,
session_id=session['session_id']))
Generation(prompt=prompt, folder=folder, session_id=session['session_id'], id=f"{gens.count}")
)
generate_and_save(g.prompt, g.id, g.folder)

return generation_preview(g, session), clear_input
Expand Down
4 changes: 3 additions & 1 deletion image_app_session_credits/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ async def static(fname:str, ext:str): return FileResponse(f'{fname}.{ext}')
async def post(prompt:str, session):
folder = f"gens/{str(uuid.uuid4())}"
os.makedirs(folder, exist_ok=True)
g = gens.insert(Generation(prompt=prompt, folder=folder, session_id=session['session_id']))
g = gens.insert(
Generation(prompt=prompt, folder=folder, session_id=session['session_id'], id=f"{gens.count}")
)
generate_and_save(g.prompt, g.id, g.folder)
clear_input = Input(id="new-prompt", name="prompt", placeholder="Enter a prompt", hx_swap_oob='true')
return generation_preview(g), clear_input
Expand Down
4 changes: 2 additions & 2 deletions image_app_simple/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

# gens database for storing generated image details
tables = database('data/gens.db').t
gens = tables.t.gens
if not gens in tables.t:
gens = tables.gens
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted changes - missed .t locally from line 11

if not gens in tables:
gens.create(prompt=str, id=int, folder=str, pk='id')
Generation = gens.dataclass()

Expand Down