Lisandro commited on
Commit
e76f467
1 Parent(s): d07b01c

volví al código de ayer

Browse files
Files changed (1) hide show
  1. app.py +25 -8
app.py CHANGED
@@ -1,25 +1,42 @@
 
 
 
 
 
 
 
 
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()
 
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
+ def predict(prompt):
13
  client = Client("fffiloni/sd-xl-custom-model")
14
  result = client.predict(
15
  custom_model="lichorosario/dott_remastered_style_lora_sdxl",
16
+ api_name="/load_model"
17
+ )
18
+
19
+ client = Client("fffiloni/sd-xl-custom-model")
20
  result = client.predict(
21
  custom_model="lichorosario/dott_remastered_style_lora_sdxl",
22
  weight_name="dott_style.safetensors",
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
  return result
34
 
35
+ with gr.Blocks() as demo:
36
+ inputs = gr.Textbox(label="Prompt")
37
+ outputs = [gr.Image(label="Image"), gr.Textbox(label="Seed")]
38
+ greet_btn = gr.Button("Generate")
39
+ greet_btn.click(fn=predict, inputs=inputs, outputs=outputs, api_name="predict")
40
 
41
+ demo.launch()
 
 
 
 
42