Spaces:
Sleeping
Sleeping
File size: 771 Bytes
7c62e0e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
from fastai.text.all import * # Or import specific modules as needed
# Load the exported model
learn = load_learner('riasec-classifier.pkl') # Path to your .pkl file
# Define a prediction function
def classify_text(text):
pred, idx, probs = learn.predict(text)
return {learn.dls.vocab[1][i]: float(probs[i]) for i in range(len(probs))}
# Create the Gradio interface
interface = gr.Interface(
fn=classify_text,
inputs=gr.Textbox(label="Enter job description"),
outputs=gr.Label(num_top_classes=3, label="Prediction"), # Adjust num_top_classes as needed
title="RIASEC Predictor",
description="Predict the top 3 RIASEC attributes from a job description."
)
# Launch the app (run this in your script)
interface.launch()
|