dnth commited on
Commit
7c62e0e
·
verified ·
1 Parent(s): 90daf54

Create app.py

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