import gradio as gr # Replace 'your_space' with the actual names of your Hugging Face spaces ds_space = "artificialguybr/DREAMSHAPER-XL-FREE-DEMO" es_space = "akhaliq/Real-ESRGAN" try: ds_iface = gr.Interface.load(ds_space) print("Loaded Dreamshaper Interface:", ds_iface) except Exception as e: print("Failed to load Dreamshaper Interface:", str(e)) try: es_iface = gr.Interface.load(es_space) print("Loaded ESRGAN Interface:", es_iface) except Exception as e: print("Failed to load ESRGAN Interface:", str(e)) from asyncio import constants import gradio as gr import re demo = gr.Blocks() with demo: print("Interfaces Loaded:", ds_iface, es_iface) # Check if interfaces are loaded correctly def desc_to_image(desc): desc = " ".join(desc.split('\n')) prompt = re.sub(r'[^a-zA-Z0-9 ,.]', '', desc) try: img = ds_iface(prompt)[0] # Ensure ds_iface is callable and returns expected result except Exception as e: print("Error in desc_to_image:", e) return None return img def upscale_img(img): try: model = 'base' uimg = es_iface(img, model) # Ensure es_iface is callable and returns expected result except Exception as e: print("Error in upscale_img:", e) return None return uimg gr.Markdown("