# Import necessary libraries import gradio as gr import spacy # Load the trained spaCy model model_path = "./my_trained_model" nlp = spacy.load(model_path) # Function to classify text def classify_text(text): doc = nlp(text) predicted_labels = doc.cats return predicted_labels # Gradio Interface def classify_and_save(input_text): predicted_labels = classify_text(input_text) return predicted_labels iface = gr.Interface(classify_and_save, "textbox", "json", title="Text Classifier", description="Enter your text") iface.launch(share=True)