| import gradio as gr | |
| from transformers import pipeline | |
| # Initialize the pipeline | |
| pipe = pipeline("feature-extraction", model="ECOFRI/CXR-LLAVA-v2", trust_remote_code=True) | |
| # Define a function to process inputs and return outputs | |
| def extract_features(text): | |
| features = pipe(text) | |
| return features | |
| # Create a Gradio interface | |
| iface = gr.Interface( | |
| fn=extract_features, | |
| inputs="text", | |
| outputs="json", | |
| title="Feature Extraction Demo", | |
| description="Enter text to extract features using the ECOFRI/CXR-LLAVA-v2 model." | |
| ) | |
| # Launch the interface | |
| iface.launch() |