Spaces:
Running
Running
File size: 1,406 Bytes
39b3d5c 2162e3e 39b3d5c c1a9a8e ba00eb1 39b3d5c d77c785 39b3d5c a2ddcd6 39b3d5c cefcc96 a2ddcd6 39b3d5c a2ddcd6 39b3d5c 3206893 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import gradio as gr
from gradio_client import Client
def get_caption(image_in):
client = Client("https://vikhyatk-moondream1.hf.space/")
result = client.predict(
image_in, # filepath in 'image' Image component
"Describe the image", # str in 'Question' Textbox component
api_name="/answer_question"
)
print(result)
return result
def get_lcm(prompt):
client = Client("https://latent-consistency-lcm-lora-for-sdxl.hf.space/")
result = client.predict(
prompt, # str in 'parameter_5' Textbox component
0.3, # float (numeric value between 0.0 and 5) in 'Guidance' Slider component
8, # float (numeric value between 2 and 10) in 'Steps' Slider component
0, # float (numeric value between 0 and 12013012031030) in 'Seed' Slider component
True, # bool in 'Randomize' Checkbox component
api_name="/predict"
)
print(result)
return result[0]
def infer(image_in):
caption = get_caption(image_in)
img_var = get_lcm(caption)
return img_var
gr.Interface(
title = "Supa Fast Image Variation",
description = "Get quick image variation from image input, using moondream1 for caption, and LCM SDXL for image generation",
fn = infer,
inputs = [
gr.Image(type="filepath", label="Image input")
],
outputs = [
gr.Image(label="LCM Image variation")
]
).queue(max_size=25).launch() |