import gradio as gr from gradio_client import Client def generate_omni_image(prompt, aspect_ratio): client = Client("selfit-camera/Omni-Image-Editor") try: # Ensure aspect_ratio is a string for the API result = client.predict( prompt=prompt, aspect_ratio=aspect_ratio, api_name="/text_to_image_interface" ) # The API returns a tuple, with the image URL usually as the first element if isinstance(result, (list, tuple)) and result: # The first element is often the image in HTML format or a direct URL # Let's try to extract a direct image URL if possible from the HTML string image_output = result[0] if isinstance(image_output, str) and "