Image to refer test
Browse files
app.py
CHANGED
|
@@ -10,9 +10,6 @@ from huggingface_hub import snapshot_download
|
|
| 10 |
SPACE_USERNAME = 'KR_4dmin'
|
| 11 |
SPACE_PASSWORD = 'KR_4dmin'
|
| 12 |
|
| 13 |
-
if not SPACE_USERNAME or not SPACE_PASSWORD:
|
| 14 |
-
raise ValueError("Las credenciales no están configuradas correctamente.")
|
| 15 |
-
|
| 16 |
snapshot_download(repo_id="Roomie/xavyy", cache_dir='./')
|
| 17 |
|
| 18 |
pipeline = AutoPipelineForText2Image.from_pretrained(
|
|
@@ -25,7 +22,7 @@ MAX_IMAGE_SIZE = 1024
|
|
| 25 |
|
| 26 |
|
| 27 |
@spaces.GPU
|
| 28 |
-
def infer(prompt, height, width):
|
| 29 |
|
| 30 |
image = pipeline(
|
| 31 |
prompt=prompt,
|
|
@@ -33,10 +30,11 @@ def infer(prompt, height, width):
|
|
| 33 |
# num_inference_steps=num_inference_steps,
|
| 34 |
width=width,
|
| 35 |
height=height,
|
|
|
|
| 36 |
# generator=generator
|
| 37 |
).images[0]
|
| 38 |
|
| 39 |
-
return image
|
| 40 |
|
| 41 |
|
| 42 |
examples = [
|
|
@@ -68,9 +66,11 @@ with gr.Blocks(css=css) as demo:
|
|
| 68 |
container=False,
|
| 69 |
)
|
| 70 |
|
| 71 |
-
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
result = gr.Image(label="Result", show_label=
|
| 74 |
|
| 75 |
with gr.Accordion("Advanced Settings", open=False):
|
| 76 |
|
|
@@ -138,7 +138,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 138 |
gr.on(
|
| 139 |
triggers=[run_button.click, prompt.submit],
|
| 140 |
fn=infer,
|
| 141 |
-
inputs=[prompt, height, width],
|
| 142 |
outputs=[result]
|
| 143 |
)
|
| 144 |
|
|
|
|
| 10 |
SPACE_USERNAME = 'KR_4dmin'
|
| 11 |
SPACE_PASSWORD = 'KR_4dmin'
|
| 12 |
|
|
|
|
|
|
|
|
|
|
| 13 |
snapshot_download(repo_id="Roomie/xavyy", cache_dir='./')
|
| 14 |
|
| 15 |
pipeline = AutoPipelineForText2Image.from_pretrained(
|
|
|
|
| 22 |
|
| 23 |
|
| 24 |
@spaces.GPU
|
| 25 |
+
def infer(prompt, refer_image, height, width):
|
| 26 |
|
| 27 |
image = pipeline(
|
| 28 |
prompt=prompt,
|
|
|
|
| 30 |
# num_inference_steps=num_inference_steps,
|
| 31 |
width=width,
|
| 32 |
height=height,
|
| 33 |
+
image=refer_image
|
| 34 |
# generator=generator
|
| 35 |
).images[0]
|
| 36 |
|
| 37 |
+
return 'image'
|
| 38 |
|
| 39 |
|
| 40 |
examples = [
|
|
|
|
| 66 |
container=False,
|
| 67 |
)
|
| 68 |
|
| 69 |
+
refer_image = gr.Image(show_label=True, label="Reference image")
|
| 70 |
+
|
| 71 |
+
run_button = gr.Button("Run", scale=0)
|
| 72 |
|
| 73 |
+
result = gr.Image(label="Result", show_label=True)
|
| 74 |
|
| 75 |
with gr.Accordion("Advanced Settings", open=False):
|
| 76 |
|
|
|
|
| 138 |
gr.on(
|
| 139 |
triggers=[run_button.click, prompt.submit],
|
| 140 |
fn=infer,
|
| 141 |
+
inputs=[prompt, refer_image, height, width],
|
| 142 |
outputs=[result]
|
| 143 |
)
|
| 144 |
|