Commit 56f11e80 authored by duanjinfei's avatar duanjinfei

update predit

parent 1f37ab75
No preview for this file type
...@@ -4,14 +4,9 @@ ...@@ -4,14 +4,9 @@
from cog import BasePredictor, Input, Path from cog import BasePredictor, Input, Path
from typing import List from typing import List
from modelscope.pipelines import pipeline from modelscope.pipelines import pipeline
from util import save_images, read_img_result from util import read_img_result
img_save_folder = "SaveImages" img_save_folder = "SaveImages"
params = {
"show_debug": True,
"image_count": 2,
"ddim_steps": 20,
}
class Predictor(BasePredictor): class Predictor(BasePredictor):
...@@ -25,15 +20,49 @@ class Predictor(BasePredictor): ...@@ -25,15 +20,49 @@ class Predictor(BasePredictor):
"text-generation", "text-editing"]), "text-generation", "text-editing"]),
prompt: str = Input(description="Input prompt", prompt: str = Input(description="Input prompt",
default='photo of caramel macchiato coffee on the table, top-down perspective, with "Any" "Text" written on it using cream'), default='photo of caramel macchiato coffee on the table, top-down perspective, with "Any" "Text" written on it using cream'),
seed: int = Input(description="", default=66273235, seed: int = Input(description="Seed", default=66273235,
ge=0, le=66273235), ge=0, le=66273235),
draw_pos: Path = Input( draw_pos: Path = Input(
description="", default='https://replicate.delivery/pbxt/LIHKXdjxOWFe7HqP1rliIsghRab48EVQRzGNwQ9RgyO5V03d/gen9.png'), description="Draw Pos", default='https://replicate.delivery/pbxt/LIHKXdjxOWFe7HqP1rliIsghRab48EVQRzGNwQ9RgyO5V03d/gen9.png'),
ori_image: Path = Input( ori_image: Path = Input(
description="", default='https://replicate.delivery/pbxt/LIHMZ8cCvmndHNVufiSuKZA4mnokuSOy87cYqhvs4Diei7sL/edit9.png'), description="Ori Image", default='https://replicate.delivery/pbxt/LIHMZ8cCvmndHNVufiSuKZA4mnokuSOy87cYqhvs4Diei7sL/edit9.png'),
use_fp32: bool = Input(description="", default=False), img_count: int = Input(description="Image Count",
no_translator: bool = Input(description="", default=False), default=2, ge=0, le=5),
ddim_steps: int = Input(description="DDIM Steps",
default=20, ge=20, le=100),
use_fp32: bool = Input(description="Use Fp32", default=False),
no_translator: bool = Input(
description="No Translator", default=False),
strength: float = Input(description="", default=1.0, ge=0.0, le=2.0),
img_width: int = Input(description="Image Width",
default=512, ge=256, le=768),
img_height: int = Input(
description="Image Height", default=512, ge=512, le=1024),
cfg_scale: float = Input(
description="CFG-Scale", default=9.0, ge=0.1, le=30.0),
a_prompt: str = Input(description="Added Prompt",
default="best quality, extremely detailed,4k, HD, supper legible text, clear text edges, clear strokes, neat writing, no watermarks"),
n_prompt: str = Input(description="Negative Prompt",
default="low-res, bad anatomy, extra digit, fewer digits, cropped, worst quality, low quality, watermark, unreadable text, messy words, distorted text, disorganized writing, advertising picture"),
sort_radio: str = Input(description="Sort Position,position sorting priority", choices=[
"↕", "↔"], default="↕"),
revise_pos: bool = Input(
description="Revise Position", default=False),
) -> List[Path]: ) -> List[Path]:
params = {
"show_debug": True,
"image_count": img_count,
"ddim_steps": ddim_steps,
"strength": strength,
"image_width": img_width,
"image_height": img_height,
"a_prompt": a_prompt,
"n_prompt": n_prompt,
"cfg_scale": cfg_scale,
"revise_pos": revise_pos,
"sort_priority": sort_radio,
}
input_data = {} input_data = {}
if mode == "text-generation": if mode == "text-generation":
input_data = { input_data = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment