olalla / app.py
sdas2485's picture
Create app.py
89c8472 verified
raw
history blame contribute delete
702 Bytes
# Install required libraries
!pip install transformers torch gradio
# Import necessary libraries
from transformers import pipeline
import gradio as gr
# Load the pre-trained radiography model
model = pipeline("image-to-text", model="forestav/unsloth_vision_radiography_finetune")
# Function to analyze an uploaded radiography image
def analyze_radiography(image):
result = model(image)
return result[0]['generated_text']
# Create Gradio interface
interface = gr.Interface(
fn=analyze_radiography,
inputs="image",
outputs="text",
title="Radiography Failure Detector",
description="Upload a radiography image to detect defects."
)
# Launch the app
interface.launch()