garyd1 commited on
Commit
5caa7e0
·
verified ·
1 Parent(s): d79fbe1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -10,11 +10,11 @@ import PyPDF2
10
  stt_model = pipeline("automatic-speech-recognition", model="openai/whisper-tiny")
11
  embedding_model = SentenceTransformer("all-MiniLM-L6-v2")
12
 
13
- gpt_model_name = "google/flan-t5-base"
14
  gpt_tokenizer = AutoTokenizer.from_pretrained(gpt_model_name)
15
  gpt_model = AutoModelForSeq2SeqLM.from_pretrained(gpt_model_name)
16
 
17
- tts_model = TTS(model_name="tts_models/en/ljspeech/tacotron2-DDC", progress_bar=False, gpu=False)
18
 
19
  # Parse PDF and create resume content
20
  def parse_resume(pdf):
@@ -100,17 +100,17 @@ def finalize_interview():
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(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()
 
10
  stt_model = pipeline("automatic-speech-recognition", model="openai/whisper-tiny")
11
  embedding_model = SentenceTransformer("all-MiniLM-L6-v2")
12
 
13
+ gpt_model_name = "google/flan-t5-small" # Switched to a smaller model for faster loading
14
  gpt_tokenizer = AutoTokenizer.from_pretrained(gpt_model_name)
15
  gpt_model = AutoModelForSeq2SeqLM.from_pretrained(gpt_model_name)
16
 
17
+ tts_model = TTS(model_name="tts_models/en/ljspeech/tacotron2", progress_bar=False, gpu=False) # Using a lighter TTS model
18
 
19
  # Parse PDF and create resume content
20
  def parse_resume(pdf):
 
100
  interface = gr.Blocks()
101
 
102
  with interface:
103
+ gr.Markdown("### Mock Interview AI\nUpload your resume and job description, then press Submit to start the interview.")
104
 
105
  resume_input = gr.File(label="Upload Resume (PDF)")
106
  job_desc_input = gr.Textbox(label="Paste Job Description")
107
+ submit_button = gr.Button("Submit")
108
  audio_input = gr.Audio(type="filepath", label="Your Response")
109
  question_audio_output = gr.Audio(label="Question Audio")
110
  transcription_output = gr.Textbox(label="Transcription")
111
 
112
+ submit_button.click(start_interview, inputs=[resume_input, job_desc_input], outputs=[question_audio_output])
113
  audio_input.change(process_response, inputs=[audio_input], outputs=[transcription_output, question_audio_output])
 
114
 
115
  if __name__ == "__main__":
116
  interface.launch()