Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
# Load the model from Hugging Face Hub | |
model_name = "yosrissa/AITA-D-BERT-classifier" # Replace with your Hugging Face model name | |
classifier = pipeline("text-classification", model=model_name) | |
def classify_text(input_text): | |
""" | |
Classify the input text using the model. | |
""" | |
results = classifier(input_text) | |
return results | |
# Create the Gradio interface | |
with gr.Blocks() as app: | |
gr.Markdown("# Text Classification App") | |
gr.Markdown("Enter text to classify:") | |
input_text = gr.Textbox(label="Input Text") | |
output = gr.JSON(label="Classification Results") | |
submit_button = gr.Button("Classify") | |
submit_button.click(classify_text, inputs=[input_text], outputs=[output]) | |
# Launch the app | |
if __name__ == "__main__": | |
app.launch() | |