Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -85,34 +85,32 @@ class MockInterview:
|
|
85 |
|
86 |
mock_interview = MockInterview()
|
87 |
|
88 |
-
# Gradio Interface
|
89 |
def start_interview(resume, job_desc):
|
90 |
-
|
|
|
91 |
|
92 |
-
def
|
93 |
-
|
|
|
94 |
|
95 |
-
def
|
96 |
-
|
|
|
97 |
|
98 |
interface = gr.Blocks()
|
99 |
|
100 |
with interface:
|
101 |
gr.Markdown("### Mock Interview AI\nUpload your resume and job description, and engage in a realistic audio-based mock interview simulation.")
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
audio_input = gr.Audio(type="filepath", label="Your Response")
|
108 |
question_audio_output = gr.Audio(label="Question Audio")
|
109 |
transcription_output = gr.Textbox(label="Transcription")
|
110 |
-
interaction_button = gr.Button("Next Interaction")
|
111 |
-
end_button = gr.Button("End Interview")
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
|
117 |
if __name__ == "__main__":
|
118 |
interface.launch()
|
|
|
85 |
|
86 |
mock_interview = MockInterview()
|
87 |
|
|
|
88 |
def start_interview(resume, job_desc):
|
89 |
+
question, audio = mock_interview.start_interview(resume, job_desc)
|
90 |
+
return audio
|
91 |
|
92 |
+
def process_response(user_audio):
|
93 |
+
transcription, audio = mock_interview.next_interaction(user_audio)
|
94 |
+
return transcription, audio
|
95 |
|
96 |
+
def finalize_interview():
|
97 |
+
message, audio = mock_interview.end_interview()
|
98 |
+
return audio
|
99 |
|
100 |
interface = gr.Blocks()
|
101 |
|
102 |
with interface:
|
103 |
gr.Markdown("### Mock Interview AI\nUpload your resume and job description, and engage in a realistic audio-based mock interview simulation.")
|
104 |
|
105 |
+
resume_input = gr.File(label="Upload Resume (PDF)")
|
106 |
+
job_desc_input = gr.Textbox(label="Paste Job Description")
|
107 |
+
audio_input = gr.Audio(source="microphone", type="filepath", label="Your Response")
|
|
|
|
|
108 |
question_audio_output = gr.Audio(label="Question Audio")
|
109 |
transcription_output = gr.Textbox(label="Transcription")
|
|
|
|
|
110 |
|
111 |
+
resume_input.change(start_interview, inputs=[resume_input, job_desc_input], outputs=[question_audio_output])
|
112 |
+
audio_input.change(process_response, inputs=[audio_input], outputs=[transcription_output, question_audio_output])
|
113 |
+
question_audio_output.change(finalize_interview, outputs=[question_audio_output])
|
114 |
|
115 |
if __name__ == "__main__":
|
116 |
interface.launch()
|