Spaces:
Sleeping
Sleeping
Upload 5 files
Browse files- app.py +62 -0
- best_model_mlp.h5 +3 -0
- logo.png +0 -0
- numerical_preprocessor.joblib +3 -0
- requirements.txt +20 -0
app.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import joblib
|
| 3 |
+
import numpy as np
|
| 4 |
+
import pandas as pd # Adicionado para criar DataFrame
|
| 5 |
+
from tensorflow.keras.models import load_model # Adicionado para modelos Keras
|
| 6 |
+
|
| 7 |
+
# Carrega o modelo e o pré-processador
|
| 8 |
+
model = load_model('best_model_mlp.h5')
|
| 9 |
+
preprocessor = joblib.load('numerical_preprocessor.joblib')
|
| 10 |
+
|
| 11 |
+
def classify_candidate(exp, excel, power_bi, tableau, ingles, IA, NLP):
|
| 12 |
+
# Cria um DataFrame (não array) com os inputs do usuário
|
| 13 |
+
input_data = pd.DataFrame([[
|
| 14 |
+
exp, excel, power_bi, tableau, ingles, IA, NLP
|
| 15 |
+
]], columns=[
|
| 16 |
+
"experiencia", "excel", "power_bi", "tableau", "ingles", "IA", "NLP"
|
| 17 |
+
|
| 18 |
+
])
|
| 19 |
+
|
| 20 |
+
# Aplica o pré-processamento
|
| 21 |
+
processed_data = preprocessor.transform(input_data)
|
| 22 |
+
|
| 23 |
+
# Predição (modelo Keras retorna probabilidades diretamente)
|
| 24 |
+
probability = model.predict(processed_data, verbose=0)[0][0] # Assume saída binária
|
| 25 |
+
prediction = 1 if probability >= 0.5 else 0
|
| 26 |
+
|
| 27 |
+
# Formatação do resultado
|
| 28 |
+
if prediction == 1:
|
| 29 |
+
result = "<span style='color: green; font-size: 20px;'>✅ APTO</span>"
|
| 30 |
+
else:
|
| 31 |
+
result = "<span style='color: red; font-size: 20px;'>❌ INAPTO</span>"
|
| 32 |
+
|
| 33 |
+
details = f"Probabilidade: {probability*100:.2f}% (Apto)"
|
| 34 |
+
return result, details
|
| 35 |
+
|
| 36 |
+
# Define os inputs da interface
|
| 37 |
+
inputs = [
|
| 38 |
+
gr.Slider(0, 10, step=1, label="Anos de Experiência em Ciência de Dados"),
|
| 39 |
+
gr.Slider(0, 5, step=1, label="Proficiência em Excel"),
|
| 40 |
+
gr.Slider(0, 5, step=1, label="Proficiência em Power BI"),
|
| 41 |
+
gr.Slider(0, 5, step=1, label="Proficiência em Tableau"),
|
| 42 |
+
gr.Slider(0, 5, step=1, label="Proficiência em Inglês"),
|
| 43 |
+
gr.Slider(0, 5, step=1, label="Proficiência em IA/ML"),
|
| 44 |
+
gr.Slider(0, 5, step=1, label="Proficiência em NLP"),
|
| 45 |
+
]
|
| 46 |
+
|
| 47 |
+
# Outputs
|
| 48 |
+
outputs = [
|
| 49 |
+
gr.HTML(label="Resultado da Classificação"),
|
| 50 |
+
gr.Textbox(label="Detalhes")
|
| 51 |
+
]
|
| 52 |
+
|
| 53 |
+
# Cria a interface
|
| 54 |
+
interface = gr.Interface(
|
| 55 |
+
fn=classify_candidate,
|
| 56 |
+
inputs=inputs,
|
| 57 |
+
outputs=outputs,
|
| 58 |
+
title="Classificador de Candidatos - Cientista de Dados",
|
| 59 |
+
theme="soft"
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
interface.launch()
|
best_model_mlp.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:06029c26ca2fc8bc80d2ed057c593ae60b89c22f5c58729f99ad63eb594e629a
|
| 3 |
+
size 52496
|
logo.png
ADDED
|
numerical_preprocessor.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:87cf73d72c1339a2c26625e8d25422b00eeba80125b1ff2c482703c5f3eeefa1
|
| 3 |
+
size 2472
|
requirements.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<<<<<<< HEAD
|
| 2 |
+
gradio
|
| 3 |
+
langchain
|
| 4 |
+
langchain-community
|
| 5 |
+
openai
|
| 6 |
+
python-dotenv
|
| 7 |
+
PyPDF2
|
| 8 |
+
pypdf
|
| 9 |
+
faiss-cpu
|
| 10 |
+
=======
|
| 11 |
+
gradio
|
| 12 |
+
langchain
|
| 13 |
+
langchain-community
|
| 14 |
+
openai
|
| 15 |
+
python-dotenv
|
| 16 |
+
PyPDF2
|
| 17 |
+
pypdf
|
| 18 |
+
faiss-cpu
|
| 19 |
+
>>>>>>> c759364606b43d8365c6a590adb1b980b00214ba
|
| 20 |
+
sentence-transformers
|