File size: 1,272 Bytes
ef51994 43637ef ef51994 185aeef ef51994 43637ef ef51994 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# -*- coding: utf-8 -*-
"""gradio_deploy.ipynb
Automatically generated by Colaboratory.
"""
import os
import gradio
from PIL import Image
from timeit import default_timer as timer
from tensorflow import keras
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
import numpy as np
loaded_model = AutoModelForSequenceClassification.from_pretrained("runaksh/ResumeClassification_distilBERT")
loaded_tokenizer = AutoTokenizer.from_pretrained("runaksh/ResumeClassification_distilBERT")
# Function for class prediction
def predict(sample, validate=True):
classifier = pipeline("text-classification", model=loaded_model, tokenizer=loaded_tokenizer)
pred = classifier(sample)[0]['label']
return pred
title = "Categorizing the Resumes"
description = "Enter the Resume you want to categorize"
# Gradio elements
# Input from user
in_prompt = gradio.components.Textbox(lines=2, label='Enter the Resume you want to classify')
# Output response
out_response = gradio.components.Textbox(label='Category')
# Gradio interface to generate UI link
iface = gradio.Interface(fn=predict,
inputs = in_prompt,
outputs = out_response
)
iface.launch(debug = True) |