Fix social previews and remove default style
This commit is contained in:
parent
29f98ffd39
commit
b60dcf06c8
|
@ -66,7 +66,7 @@ func parseConfig(name string, cfg *Config) (err error) {
|
|||
cfg.AspectRatio = "1024*1024"
|
||||
}
|
||||
if len(cfg.Sampler) == 0 {
|
||||
cfg.Sampler = "euler_a"
|
||||
cfg.Sampler = "euler_ancestral"
|
||||
}
|
||||
if cfg.UserPromptBias == 0 {
|
||||
cfg.UserPromptBias = 0.5
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>{{ .Label.Title }}</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta property="og:image" content="https://{{ .SocialURL }}" />
|
||||
<meta property="og:description" content="{{ .Label.Title}}, {{ .Label.Date }}" />
|
||||
<style>
|
||||
body {
|
||||
display: flex;
|
||||
|
@ -48,7 +52,6 @@
|
|||
font-weight: 300;
|
||||
}
|
||||
</style>
|
||||
<meta property="og:image" content={{ .Img.URL }} />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
@ -32,6 +32,7 @@ type FooocusTxt2Img struct {
|
|||
NegativePrompt string `json:"negative_prompt,omitempty"`
|
||||
BaseModelName string `json:"base_model_name,omitempty"`
|
||||
Loras []Lora `json:"loras,omitempty"`
|
||||
Styles []string `json:"style_selections"`
|
||||
AspectRatio string `json:"aspect_ratios_selection,omitempty"`
|
||||
ImageSeed int `json:"image_seed,omitempty"`
|
||||
Sharpness float64 `json:"sharpness,omitempty"`
|
||||
|
@ -48,6 +49,7 @@ func buildTxt2ImgQuery(prompt string) (data []byte, err error) {
|
|||
|
||||
query.Api_name = "txt2img"
|
||||
query.RequireBase64 = true // necessary
|
||||
query.Styles = []string{""}
|
||||
query.Loras = config.Loras
|
||||
query.AspectRatio = config.AspectRatio
|
||||
query.GuidanceScale = config.GuidanceScale
|
||||
|
|
11
html.go
11
html.go
|
@ -42,11 +42,12 @@ type Label struct {
|
|||
}
|
||||
|
||||
type PageContent struct {
|
||||
Img Img
|
||||
Label Label
|
||||
Img Img
|
||||
Label Label
|
||||
SocialURL string
|
||||
}
|
||||
|
||||
func writeDisplayPage(w http.ResponseWriter, m FileData) (err error) {
|
||||
func writeDisplayPage(w http.ResponseWriter, r *http.Request, m FileData) (err error) {
|
||||
tmpl, err := template.New("display").Parse(displayTmpl)
|
||||
if err != nil {
|
||||
ErrorLogger.Println(err)
|
||||
|
@ -74,7 +75,9 @@ func writeDisplayPage(w http.ResponseWriter, m FileData) (err error) {
|
|||
Date: fmt.Sprintf("%d", m.Date.Year()),
|
||||
Size: fmt.Sprintf("%s x %s cm", widthCm, heightCm),
|
||||
Technique: m.Metadata["Technique"],
|
||||
}}
|
||||
},
|
||||
SocialURL: r.Host + "/img.png",
|
||||
}
|
||||
err = tmpl.Execute(w, tmplData)
|
||||
if err != nil {
|
||||
ErrorLogger.Println(err)
|
||||
|
|
Loading…
Reference in a new issue