lichorosario commited on
Commit
d07b01c
·
verified ·
1 Parent(s): f41b10b

vuelvo a la prueba original

Browse files
Files changed (1) hide show
  1. app.py +15 -136
app.py CHANGED
@@ -1,146 +1,25 @@
1
- import os
2
- import gradio as gr
3
-
4
- api_key = os.getenv('HF_API_KEY')
5
-
6
- # with gr.Blocks() as demo:
7
- # gr.load("fffiloni/sd-xl-custom-model", api_key=api_key, hf_token=api_key, src="spaces")
8
-
9
  from gradio_client import Client
10
 
11
- custom_model="lichorosario/dott_remastered_style_lora_sdxl",
12
- weight_name="dott_style.safetensors",
13
 
14
- def infer (prompt, inf_steps, guidance_scale, width, height, seed, lora_weight):
15
  client = Client("fffiloni/sd-xl-custom-model")
16
  result = client.predict(
17
- custom_model=custom_model,
18
- api_name="/load_model"
19
- )
20
-
21
- # client = Client("fffiloni/sd-xl-custom-model")
22
- # result = client.predict(
23
- # custom_model=custom_model,
24
- # weight_name=weight_name,
25
- # prompt="dott style. "+prompt,
26
- # inf_steps=inf_steps,
27
- # guidance_scale=guidance_scale,
28
- # width=width,
29
- # height=height,
30
- # seed=-seed,
31
- # lora_weight=lora_weight,
32
- # api_name="/infer"
33
- # )
34
 
35
  return result
36
 
37
 
 
 
 
 
 
38
 
39
-
40
- css="""
41
- #col-container{
42
- margin: 0 auto;
43
- max-width: 720px;
44
- text-align: left;
45
- }
46
- div#warning-duplicate {
47
- background-color: #ebf5ff;
48
- padding: 0 16px 16px;
49
- margin: 20px 0;
50
- }
51
- div#warning-duplicate > .gr-prose > h2, div#warning-duplicate > .gr-prose > p {
52
- color: #0f4592!important;
53
- }
54
- div#warning-duplicate strong {
55
- color: #0f4592;
56
- }
57
- p.actions {
58
- display: flex;
59
- align-items: center;
60
- margin: 20px 0;
61
- }
62
- div#warning-duplicate .actions a {
63
- display: inline-block;
64
- margin-right: 10px;
65
- }
66
- button#load_model_btn{
67
- height: 46px;
68
- }
69
- #status_info{
70
- font-size: 0.9em;
71
- }
72
- .custom-color {
73
- color: #030303 !important;
74
- }
75
- """
76
-
77
- with gr.Blocks(css=css) as demo:
78
- with gr.Column(elem_id="col-container"):
79
- prompt_in = gr.Textbox(
80
- label="Your Prompt",
81
- info = "Dont' forget to include your trigger word if necessary"
82
- )
83
- with gr.Accordion("Advanced Settings", open=False):
84
- with gr.Row():
85
- inf_steps = gr.Slider(
86
- label="Inference steps",
87
- minimum=12,
88
- maximum=50,
89
- step=1,
90
- value=25
91
- )
92
- guidance_scale = gr.Slider(
93
- label="Guidance scale",
94
- minimum=0.0,
95
- maximum=50.0,
96
- step=0.1,
97
- value=7.5
98
- )
99
- with gr.Row():
100
- width = gr.Slider(
101
- label="Width",
102
- minimum=256,
103
- maximum=2048,
104
- step=32,
105
- value=1024,
106
- )
107
- height = gr.Slider(
108
- label="Height",
109
- minimum=256,
110
- maximum=2048,
111
- step=32,
112
- value=1024,
113
- )
114
-
115
- with gr.Row():
116
- seed = gr.Slider(
117
- label="Seed",
118
- info = "-1 denotes a random seed",
119
- minimum=-1,
120
- maximum=423538377342,
121
- step=1,
122
- value=-1
123
- )
124
- last_used_seed = gr.Number(
125
- label = "Last used seed",
126
- info = "the seed used in the last generation",
127
- )
128
- lora_weight = gr.Slider(
129
- label="LoRa weigth",
130
- minimum=0.0,
131
- maximum=1.0,
132
- step=0.01,
133
- value=1.0
134
- )
135
- submit_btn = gr.Button("Submit")
136
- image_out = gr.Image(label="Image output")
137
-
138
- submit_btn.click(
139
- fn = infer,
140
- inputs = [prompt_in, inf_steps, guidance_scale, width, height, seed, lora_weight],
141
- outputs = [last_used_seed]
142
- )
143
-
144
-
145
- demo.launch()
146
-
 
 
 
 
 
 
 
 
 
1
  from gradio_client import Client
2
 
 
 
3
 
4
+ def predict():
5
  client = Client("fffiloni/sd-xl-custom-model")
6
  result = client.predict(
7
+ custom_model="lichorosario/dott_remastered_style_lora_sdxl",
8
+ result = client.predict(
9
+ custom_model="lichorosario/dott_remastered_style_lora_sdxl",
10
+ weight_name="dott_style.safetensors",
11
+ prompt="house interior. two vanishing points, one at the left and one at the right. Cartoon background. Curved perspective. Retro cartoon scene. twisted objects. simple irregular shapes. Cartoon Expressionism.foreshortening. wide angle. lens distortion. converging lines",
12
+ inf_steps=25,
13
+ guidance_scale=12,
14
+ width=1024,
 
 
 
 
 
 
 
 
 
15
 
16
  return result
17
 
18
 
19
+ demo = gr.Interface(
20
+ fn=predict,
21
+ inputs=[],
22
+ outputs=["image", "text"],
23
+ )
24
 
25
+ demo.launch()