import gradio as gr from transformers import pipeline # Initialize the classification pipeline with your private model and token pipe = pipeline( task="image-classification", model="scfive/weaponsclass", # Replace with your model repository identifier ) # Define custom CSS to style the header, footer, and main container custom_css = """ /* Header styling */ #header { background-color: #003366; color: #ffffff; padding: 20px; text-align: center; font-family: 'Arial', sans-serif; } #header img { max-width: 100px; vertical-align: middle; margin-right: 15px; } /* Footer styling */ #footer { background-color: #f0f4f8; color: #003366; padding: 10px; text-align: center; font-family: 'Arial', sans-serif; font-size: 0.9em; } /* Main container styling */ .main-container { padding: 20px; margin: auto; max-width: 800px; } /* Button styling */ button { font-size: 1em; padding: 10px 20px; } """ # Define the image classification function def classify_image(image_path): result = pipe(image_path) # Return the label from the first result return result[0]['label'] # Build the Gradio Blocks layout with gr.Blocks(css=custom_css) as demo: # Header: includes a logo and the app name gr.HTML("""