Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import PyPDF2
|
|
7 |
|
8 |
# Load local models for inference
|
9 |
stt_model = pipeline("automatic-speech-recognition", model="openai/whisper-base")
|
10 |
-
conversation_model = pipeline("
|
11 |
|
12 |
# Load a pre-trained model for vector embeddings
|
13 |
embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
|
@@ -28,6 +28,12 @@ def process_resume(pdf):
|
|
28 |
}
|
29 |
return resume_embeddings
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
# Generate question from user response
|
32 |
def generate_question(user_input, resume_embeddings):
|
33 |
"""Find the most relevant section in the resume and generate a question."""
|
|
|
7 |
|
8 |
# Load local models for inference
|
9 |
stt_model = pipeline("automatic-speech-recognition", model="openai/whisper-base")
|
10 |
+
conversation_model = pipeline("text-generation", model="facebook/blenderbot-400M-distill")
|
11 |
|
12 |
# Load a pre-trained model for vector embeddings
|
13 |
embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
|
|
|
28 |
}
|
29 |
return resume_embeddings
|
30 |
|
31 |
+
# Generate a conversation response
|
32 |
+
def generate_conversation_response(user_input):
|
33 |
+
prompt = f"The user said: {user_input}. Respond appropriately as a recruiter."
|
34 |
+
response = conversation_model(prompt, max_length=100, num_return_sequences=1)
|
35 |
+
return response[0]["generated_text"]
|
36 |
+
|
37 |
# Generate question from user response
|
38 |
def generate_question(user_input, resume_embeddings):
|
39 |
"""Find the most relevant section in the resume and generate a question."""
|