import gradio as gr from PIL import Image import os import io def get_file_info(file): """Get file info from the uploaded file.""" if file is None: return "No file uploaded." # Extract original filename original_name = os.path.splitext(os.path.basename(file.name))[0] # Open the image file image = Image.open(file.name) # Get image dimensions width, height = image.size # Calculate file size size_bytes = os.path.getsize(file.name) size_kb = size_bytes / 1024 return f"""
Original Name: {original_name}
Size: {width}x{height}px ({size_kb:.1f} KB)