Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| # Load your pre-trained model from Hugging Face | |
| model = pipeline("text-classification", model="your-username/your-model-repo") | |
| # Define the prediction function | |
| def predict(text): | |
| return model(text) | |
| # Create Gradio interface | |
| interface = gr.Interface( | |
| fn=predict, # The prediction function | |
| inputs="text", # Input to your model (text, image, etc.) | |
| outputs="label", # Output of your model (label, text, image, etc.) | |
| title="My Model", # Title of the app | |
| description="This app predicts the category of customer support requests.", | |
| ) | |
| # Launch the interface | |
| interface.launch() | |