Spaces:
Build error
Build error
| 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 precisely the image in one sentence.", # str in 'Question' Textbox component | |
| api_name="/answer_question" | |
| ) | |
| print(result) | |
| return result | |
| def get_clm(prompt): | |
| client = Client("https://fffiloni-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 | |
| def infer(image_in): | |
| caption = get_caption(image_in) | |
| img_var = get_lcm(caption) | |
| return img_var | |
| gr.Interface( | |
| fn = infer, | |
| inputs = [ | |
| gr.Image(type="filepath") | |
| ], | |
| outputs = [ | |
| gr.Image() | |
| ] | |
| ).launch() |