Lisandro commited on
Commit
cb202cc
1 Parent(s): 3575998

corrección de chatgpt

Browse files
Files changed (1) hide show
  1. app.py +34 -35
app.py CHANGED
@@ -1,46 +1,45 @@
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
 
12
-
 
13
 
14
  def predict(prompt):
15
- custom_model="lichorosario/dott_remastered_style_lora_sdxl"
16
- weight_name="dott_style.safetensors"
17
- client = Client("fffiloni/sd-xl-custom-model")
18
- result = client.predict(
19
- custom_model=custom_model,
20
- api_name="/load_model"
21
- )
22
-
23
- client = Client("fffiloni/sd-xl-custom-model")
24
- result = client.predict(
25
- custom_model=custom_model,
26
- weight_name=weight_name,
27
- prompt=prompt,
28
- inf_steps=25,
29
- guidance_scale=12,
30
- width=1024,
31
- height=512,
32
- seed=-1,
33
- lora_weight=1,
34
- api_name="/infer"
35
- )
36
-
37
- return result
 
 
 
 
38
 
39
  with gr.Blocks() as demo:
40
- inputs = gr.Textbox(label="Prompt")
41
- outputs = [gr.Image(label="Image"), gr.Textbox(label="Seed")]
42
- greet_btn = gr.Button("Generate")
43
- greet_btn.click(fn=predict, inputs=inputs, outputs=outputs, api_name="predict")
44
 
45
  demo.launch()
46
-
 
1
  import os
2
  import gradio as gr
 
 
 
 
 
 
3
  from gradio_client import Client
4
 
5
+ api_key = os.getenv('HF_API_KEY')
6
 
7
+ custom_model = "lichorosario/dott_remastered_style_lora_sdxl"
8
+ weight_name = "dott_style.safetensors"
9
 
10
  def predict(prompt):
11
+ client = Client("fffiloni/sd-xl-custom-model", api_key=api_key)
12
+
13
+ # Load the model
14
+ client.predict(
15
+ custom_model=custom_model,
16
+ api_name="/load_model"
17
+ )
18
+
19
+ # Infer the image
20
+ result = client.predict(
21
+ custom_model=custom_model,
22
+ weight_name=weight_name,
23
+ prompt=prompt,
24
+ inf_steps=25,
25
+ guidance_scale=12,
26
+ width=1024,
27
+ height=512,
28
+ seed=-1,
29
+ lora_weight=1,
30
+ api_name="/infer"
31
+ )
32
+
33
+ # Assuming result is a dictionary with keys 'image' and 'seed'
34
+ image = result["image"]
35
+ seed = result["seed"]
36
+
37
+ return image, seed
38
 
39
  with gr.Blocks() as demo:
40
+ inputs = gr.Textbox(label="Prompt")
41
+ outputs = [gr.Image(label="Image"), gr.Textbox(label="Seed")]
42
+ greet_btn = gr.Button("Generate")
43
+ greet_btn.click(fn=predict, inputs=inputs, outputs=outputs)
44
 
45
  demo.launch()