Spaces:
Paused
Paused
update prompt parameters
Browse files- app/api/generate.py +3 -6
- app/core/schemas.py +5 -1
- app/main.py +2 -4
app/api/generate.py
CHANGED
@@ -58,8 +58,7 @@ def text_image(model: Request, request: TextImage, db: Annotated[Session, Depend
|
|
58 |
raise HTTPException(status_code=403, detail="Forbidden")
|
59 |
|
60 |
generator = torch.manual_seed(request.seed)
|
61 |
-
prompt = create_prompt(request.prompt, medium=request.medium, style=request.style,
|
62 |
-
additional_details=request.additional_details, lightning=request.lightning)
|
63 |
|
64 |
crud.create_prompt(db=db, user_id=current_user.user_id, prompt=prompt)
|
65 |
|
@@ -75,8 +74,7 @@ def image_image(model: Request, request: ImageImage, db: Annotated[Session, Depe
|
|
75 |
raise HTTPException(status_code=403, detail="Forbidden")
|
76 |
|
77 |
generator = torch.manual_seed(request.seed)
|
78 |
-
prompt = create_prompt(request.prompt, medium=request.medium, style=request.style,
|
79 |
-
additional_details=request.additional_details, lightning=request.lightning)
|
80 |
image = decode_image(request.image)
|
81 |
|
82 |
crud.create_prompt(db=db, user_id=current_user.user_id, prompt=prompt)
|
@@ -142,8 +140,7 @@ def image_variations(model: Request, request: ImageVariations, db: Annotated[Ses
|
|
142 |
if not current_user.is_active:
|
143 |
raise HTTPException(status_code=403, detail="Forbidden")
|
144 |
|
145 |
-
# prompt = create_prompt(request.prompt, medium=request.medium, style=request.style,
|
146 |
-
# additional_details=request.additional_details, lightning=request.lightning)
|
147 |
# image = decode_image(request.image)
|
148 |
# image.resize((512, 512))
|
149 |
|
|
|
58 |
raise HTTPException(status_code=403, detail="Forbidden")
|
59 |
|
60 |
generator = torch.manual_seed(request.seed)
|
61 |
+
prompt = create_prompt(request.prompt, medium=request.medium, style=request.style, artist=request.artist, website=request.website, resolution=request.resolution, additional_details=request.additional_details, color=request.color, lightning=request.lightning)
|
|
|
62 |
|
63 |
crud.create_prompt(db=db, user_id=current_user.user_id, prompt=prompt)
|
64 |
|
|
|
74 |
raise HTTPException(status_code=403, detail="Forbidden")
|
75 |
|
76 |
generator = torch.manual_seed(request.seed)
|
77 |
+
prompt = create_prompt(request.prompt, medium=request.medium, style=request.style, artist=request.artist, website=request.website, resolution=request.resolution, additional_details=request.additional_details, color=request.color, lightning=request.lightning)
|
|
|
78 |
image = decode_image(request.image)
|
79 |
|
80 |
crud.create_prompt(db=db, user_id=current_user.user_id, prompt=prompt)
|
|
|
140 |
if not current_user.is_active:
|
141 |
raise HTTPException(status_code=403, detail="Forbidden")
|
142 |
|
143 |
+
# prompt = create_prompt(request.prompt, medium=request.medium, style=request.style, artist=request.artist, website=request.website, resolution=request.resolution, additional_details=request.additional_details, color=request.color, lightning=request.lightning)
|
|
|
144 |
# image = decode_image(request.image)
|
145 |
# image.resize((512, 512))
|
146 |
|
app/core/schemas.py
CHANGED
@@ -47,8 +47,12 @@ class Generate(BaseModel):
|
|
47 |
negative_prompt : str = "ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face"
|
48 |
medium: str | None = None
|
49 |
style: str | None = None
|
50 |
-
|
|
|
|
|
51 |
additional_details: str | None = None
|
|
|
|
|
52 |
|
53 |
|
54 |
class TextImage(Generate):
|
|
|
47 |
negative_prompt : str = "ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face"
|
48 |
medium: str | None = None
|
49 |
style: str | None = None
|
50 |
+
artist: str | None = None
|
51 |
+
website: str | None = None
|
52 |
+
resolution: str | None = None
|
53 |
additional_details: str | None = None
|
54 |
+
color: str | None = None
|
55 |
+
lightning: str | None = None
|
56 |
|
57 |
|
58 |
class TextImage(Generate):
|
app/main.py
CHANGED
@@ -6,16 +6,14 @@ from fastapi.security import OAuth2PasswordRequestForm
|
|
6 |
from fastapi import APIRouter, FastAPI, HTTPException, Depends
|
7 |
|
8 |
import torch
|
9 |
-
from ip_adapter import IPAdapterXL
|
10 |
from transformers import AutoModelForImageSegmentation
|
11 |
from diffusers import AutoPipelineForText2Image, DPMSolverMultistepScheduler, StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler, StableDiffusionXLPipeline
|
12 |
|
13 |
-
from app.db import get_db, init_db
|
14 |
-
from app.sql import models
|
15 |
from app.api import user
|
16 |
from app.api import prompt
|
17 |
-
from app.sql.database import engine
|
18 |
from app.api import generate
|
|
|
19 |
from app.config import ACCESS_TOKEN_EXPIRE_MINUTES, DEVICE
|
20 |
from app.security import authenticate_user, create_access_token, timedelta
|
21 |
|
|
|
6 |
from fastapi import APIRouter, FastAPI, HTTPException, Depends
|
7 |
|
8 |
import torch
|
9 |
+
# from ip_adapter import IPAdapterXL
|
10 |
from transformers import AutoModelForImageSegmentation
|
11 |
from diffusers import AutoPipelineForText2Image, DPMSolverMultistepScheduler, StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler, StableDiffusionXLPipeline
|
12 |
|
|
|
|
|
13 |
from app.api import user
|
14 |
from app.api import prompt
|
|
|
15 |
from app.api import generate
|
16 |
+
from app.db import get_db, init_db
|
17 |
from app.config import ACCESS_TOKEN_EXPIRE_MINUTES, DEVICE
|
18 |
from app.security import authenticate_user, create_access_token, timedelta
|
19 |
|