Skip to content

Commit

Permalink
Format and update openapi.json
Browse files Browse the repository at this point in the history
Change .gitignore
Format some code
  • Loading branch information
mrhan1993 committed Apr 15, 2024
1 parent e7e3951 commit ad2de65
Show file tree
Hide file tree
Showing 7 changed files with 4,060 additions and 50 deletions.
57 changes: 19 additions & 38 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#ide config
.idea
.vscode

#runtime
__pycache__
.DS_Store

# models
*.ckpt
*.safetensors
Expand All @@ -22,46 +28,21 @@ conda
logs
log

sorted_styles.json
/language/default.json
lena.png
lena_result.png
lena_test.py
# config files
.cog
config.txt
config_modification_tutorial.txt
user_path_config.txt
user_path_config-deprecated.txt
build_chb.py
experiment.py
/modules/*.png
/tmp
/ui-config.json
/outputs
/config.json
/webui.settings.bat
/embeddings
/styles.csv
/params.txt
/styles.csv.bak
/webui-user.bat
/webui-user.sh
/interrogate
/user.css
/.idea
/notification.ogg
/notification.mp3
/SwinIR
/textual_inversion
.vscode
/extensions
/test/stdout.txt
/test/stderr.txt
/cache.json*
/config_states/
/node_modules
/package-lock.json
/.coverage*
/auth.json
.cog/

sorted_styles.json
/presets
*.db

# db
*.db

# cache
outputs

#other
*.http
2 changes: 1 addition & 1 deletion cog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ build:
- "colorlog==6.8.2"
- "rich==13.7.1"

# commands run after the environment is setup
# commands run after the environment is set up
# run:
# - "echo env is ready!"
# - "echo another command if needed"
Expand Down
4,019 changes: 4,018 additions & 1 deletion docs/openapi.json

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions examples/examples_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""
import json
import os
import base64
import requests


Expand All @@ -12,7 +11,6 @@ class Config:
Config
Attributes:
fooocus_host (str): Fooocus API host
text2img_ip (str): Text to Image with IP
img_upscale (str): Upscale or Vary
inpaint_outpaint (str): Inpaint or Outpaint
img_prompt (str): Image Prompt
Expand Down
15 changes: 11 additions & 4 deletions fooocusapi/models/common/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ class Lora(BaseModel):
for lora in default_loras:
if lora[0] != 'None':
default_loras_model.append(
Lora(enabled=lora[0], model_name=lora[1], weight=lora[2])
Lora(
enabled=lora[0],
model_name=lora[1],
weight=lora[2])
)
default_loras_json = LoraList.dump_json(default_loras_model)

Expand Down Expand Up @@ -143,7 +146,8 @@ def outpaint_selections_parser(outpaint_selections: str) -> List[OutpaintExpansi
outpaint_selections_arr.append(expansion)
except ValueError:
errs = InitErrorDetails(
type='enum', loc=['outpaint_selections'],
type='enum',
loc=tuple('outpaint_selections'),
input=outpaint_selections,
ctx={
'expected': "str, comma separated Left, Right, Top, Bottom"
Expand All @@ -166,6 +170,9 @@ def image_prompt_parser(image_prompts_config: List[Tuple]) -> List[ImagePrompt]:
return []
for config in image_prompts_config:
cn_img, cn_stop, cn_weight, cn_type = config
image_prompts.append(ImagePrompt(cn_img=cn_img, cn_stop=cn_stop,
cn_weight=cn_weight, cn_type=cn_type))
image_prompts.append(ImagePrompt(
cn_img=cn_img,
cn_stop=cn_stop,
cn_weight=cn_weight,
cn_type=cn_type))
return image_prompts
7 changes: 5 additions & 2 deletions fooocusapi/utils/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@
STATIC_SERVER_BASE = 'http://127.0.0.1:8888/files/'


def save_output_file(img: np.ndarray, image_meta: dict = None,
image_name: str = '', extension: str = 'png') -> str:
def save_output_file(
img: np.ndarray,
image_meta: dict = None,
image_name: str = '',
extension: str = 'png') -> str:
"""
Save np image to file
Args:
Expand Down
8 changes: 6 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,13 @@ def prepare_environments(args) -> bool:


def pre_setup():
"""
Pre setup, for replicate
"""
class Args(object):
"""
Arguments object
"""
host = "127.0.0.1"
port = 8888
base_url = None
Expand All @@ -163,8 +169,6 @@ class Args(object):

install_dependents(arguments.skip_pip)

import fooocusapi.args as _

prepare_environments(arguments)

# Start task schedule thread
Expand Down

0 comments on commit ad2de65

Please sign in to comment.