Chia Woon Yap commited on
Commit
b0c86b8
·
verified ·
1 Parent(s): cf4f75e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +52 -52
app.py CHANGED
@@ -310,62 +310,62 @@ def tutor_ai_chatbot():
310
 
311
  # ... rest of your event handlers remain the same
312
 
313
- # Handle chat interaction
314
- submit.click(
315
- chat_with_groq,
316
- inputs=[msg, chatbot],
317
- outputs=[chatbot, msg, audio_playback]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
  )
319
 
320
- # Clear chat history function
321
- clear_btn.click(
322
- lambda: [], # Return empty list in message format
323
- inputs=None,
324
- outputs=[chatbot]
325
- )
326
 
327
- # Also allow Enter key to submit
328
- msg.submit(
329
- chat_with_groq,
330
- inputs=[msg, chatbot],
331
- outputs=[chatbot, msg, audio_playback]
332
- )
 
333
 
334
- # Add some examples of questions students might ask
335
- with gr.Accordion("Example Questions", open=False):
336
- gr.Examples(
337
- examples=[
338
- "Can you explain the concept of RLHF AI?",
339
- "What are AI transformers?",
340
- "What is MoE AI?",
341
- "What's gate networks AI?",
342
- "I am making a switch, please generating baking recipe?"
343
- ],
344
- inputs=msg
345
- )
346
-
347
- # Connect audio input to transcription
348
- audio_input.change(fn=transcribe_audio, inputs=audio_input, outputs=msg)
349
-
350
- # Upload Notes & Generate Quiz Tab
351
- with gr.Tab("Upload Notes & Generate Quiz"):
352
- with gr.Row():
353
- with gr.Column(scale=2):
354
- file_input = gr.File(label="Upload Lecture Notes (PDF, DOCX, PPTX)")
355
- with gr.Column(scale=3):
356
- quiz_output = gr.Textbox(label="Generated Quiz", lines=10)
357
-
358
- # Connect file input to document processing
359
- file_input.change(process_document, inputs=file_input, outputs=quiz_output)
360
-
361
- # Introduction Video Tab - Now with the working video
362
- with gr.Tab("Introduction Video"):
363
- with gr.Row():
364
- with gr.Column(scale=1):
365
- gr.Markdown("### Welcome to the Introduction Video")
366
- gr.Markdown("Music from Xu Mengyuan - China-O, musician Xu Mengyuan YUAN! | 徐梦圆 - China-O 音乐人徐梦圆YUAN!")
367
- # Use the local video file that's stored in your Space
368
- gr.Video("We_not_me_video.mp4", label="Introduction Video")
369
 
370
  # Launch the application
371
  app.launch(share=False)
 
310
 
311
  # ... rest of your event handlers remain the same
312
 
313
+ # Handle chat interaction
314
+ submit.click(
315
+ chat_with_groq,
316
+ inputs=[msg, chatbot],
317
+ outputs=[chatbot, msg, audio_playback]
318
+ )
319
+
320
+ # Clear chat history function
321
+ clear_btn.click(
322
+ lambda: [], # Return empty list in message format
323
+ inputs=None,
324
+ outputs=[chatbot]
325
+ )
326
+
327
+ # Also allow Enter key to submit
328
+ msg.submit(
329
+ chat_with_groq,
330
+ inputs=[msg, chatbot],
331
+ outputs=[chatbot, msg, audio_playback]
332
+ )
333
+
334
+ # Add some examples of questions students might ask
335
+ with gr.Accordion("Example Questions", open=False):
336
+ gr.Examples(
337
+ examples=[
338
+ "Can you explain the concept of RLHF AI?",
339
+ "What are AI transformers?",
340
+ "What is MoE AI?",
341
+ "What's gate networks AI?",
342
+ "I am making a switch, please generating baking recipe?"
343
+ ],
344
+ inputs=msg
345
  )
346
 
347
+ # Connect audio input to transcription
348
+ audio_input.change(fn=transcribe_audio, inputs=audio_input, outputs=msg)
 
 
 
 
349
 
350
+ # Upload Notes & Generate Quiz Tab
351
+ with gr.Tab("Upload Notes & Generate Quiz"):
352
+ with gr.Row():
353
+ with gr.Column(scale=2):
354
+ file_input = gr.File(label="Upload Lecture Notes (PDF, DOCX, PPTX)")
355
+ with gr.Column(scale=3):
356
+ quiz_output = gr.Textbox(label="Generated Quiz", lines=10)
357
 
358
+ # Connect file input to document processing
359
+ file_input.change(process_document, inputs=file_input, outputs=quiz_output)
360
+
361
+ # Introduction Video Tab - Now with the working video
362
+ with gr.Tab("Introduction Video"):
363
+ with gr.Row():
364
+ with gr.Column(scale=1):
365
+ gr.Markdown("### Welcome to the Introduction Video")
366
+ gr.Markdown("Music from Xu Mengyuan - China-O, musician Xu Mengyuan YUAN! | 徐梦圆 - China-O 音乐人徐梦圆YUAN!")
367
+ # Use the local video file that's stored in your Space
368
+ gr.Video("We_not_me_video.mp4", label="Introduction Video")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
369
 
370
  # Launch the application
371
  app.launch(share=False)