Spaces:
Build error
Build error
Update app.py
Browse files95 unmodified lines9697989910010110210310410510695 unmodified lines# Function for direct prompt to image generationdef generate_image_from_prompt(prompt):try:image_bytes = query({"inputs": prompt})return image_bytesexcept Exception as e:return f"An error occurred during image generation: {str(e)}"# Assuming your 'process_audio' and 'generate_image_from_prompt' functions are defined elsewhere95 unmodified lines9697989910010110210310410510610710810911011111211311411511611711895 unmodified lines# Function for direct prompt to image generationdef generate_image_from_prompt(prompt):image_bytes = query({"inputs": prompt})if image_bytes is None:error_img = Image.new('RGB', (300, 300), color=(255, 0, 0))d = ImageDraw.Draw(error_img)d.text((10, 150), "Image Generation Failed", fill=(255, 255, 255))return error_imgtry:image = Image.open(io.BytesIO(image_bytes))return imageexcept Exception as e:print(f"Error: {e}")error_img = Image.new('RGB', (300, 300), color=(255, 0, 0))d = ImageDraw.Draw(error_img)d.text((10, 150), "Invalid Image Data", fill=(255, 255, 255))return error_img# Assuming your 'process_audio' and 'generate_image_from_prompt' functions are defined elsewhere
app.py+15-3