github-actions[bot] commited on
Commit
b59747b
·
1 Parent(s): 69427f5

🤖 Auto-deploy from GitHub (push) - ed922f1 - 2025-07-28 05:49:47 UTC

Browse files
.gitignore CHANGED
@@ -1,11 +1,21 @@
1
  # Byte-compiled / optimized / DLL files
2
  __pycache__/
3
  *.py[codz]
 
 
 
4
  *$py.class
5
 
6
  # C extensions
7
  *.so
8
 
 
 
 
 
 
 
 
9
  # Distribution / packaging
10
  .Python
11
  build/
 
1
  # Byte-compiled / optimized / DLL files
2
  __pycache__/
3
  *.py[codz]
4
+ *.pyc
5
+ *.pyo
6
+ *.pyd
7
  *$py.class
8
 
9
  # C extensions
10
  *.so
11
 
12
+ # OS generated files
13
+ .DS_Store
14
+ .DS_Store?
15
+ Thumbs.db
16
+ ehthumbs.db
17
+ Desktop.ini
18
+
19
  # Distribution / packaging
20
  .Python
21
  build/
apps/gradio-app/src/fitness_gradio/ui/app.py CHANGED
@@ -36,17 +36,18 @@ class FitnessAppUI:
36
  (model_dropdown, selected_model) = UIComponents.create_model_selection_section()
37
 
38
  # Main chat interface
39
- with gr.Row():
40
- with gr.Column():
41
- chatbot = UIComponents.create_chatbot()
42
- with gr.Column(scale=0.3):
43
- output_audio = UIComponents.create_output_audio()
44
 
45
  chat_input = UIComponents.create_chat_input()
46
 
47
  # Control buttons
48
  clear_btn, streaming_toggle, tts_toggle = UIComponents.create_control_buttons()
49
 
 
 
 
 
 
50
  # Examples section
51
  UIComponents.create_examples_section(chat_input)
52
 
@@ -98,6 +99,13 @@ class FitnessAppUI:
98
  # Clear conversation handler
99
  clear_btn.click(UIHandlers.clear_conversation, None, chatbot)
100
 
 
 
 
 
 
 
 
101
  # Like/dislike feedback
102
  chatbot.like(UIHandlers.print_like_dislike, None, None, like_user_message=True)
103
 
 
36
  (model_dropdown, selected_model) = UIComponents.create_model_selection_section()
37
 
38
  # Main chat interface
39
+ chatbot = UIComponents.create_chatbot()
 
 
 
 
40
 
41
  chat_input = UIComponents.create_chat_input()
42
 
43
  # Control buttons
44
  clear_btn, streaming_toggle, tts_toggle = UIComponents.create_control_buttons()
45
 
46
+ # Audio response (positioned near TTS controls)
47
+ with gr.Row():
48
+ with gr.Column():
49
+ output_audio = UIComponents.create_output_audio()
50
+
51
  # Examples section
52
  UIComponents.create_examples_section(chat_input)
53
 
 
99
  # Clear conversation handler
100
  clear_btn.click(UIHandlers.clear_conversation, None, chatbot)
101
 
102
+ # TTS toggle handler to show/hide audio component
103
+ tts_toggle.change(
104
+ UIHandlers.toggle_audio_visibility,
105
+ inputs=[tts_toggle],
106
+ outputs=[output_audio]
107
+ )
108
+
109
  # Like/dislike feedback
110
  chatbot.like(UIHandlers.print_like_dislike, None, None, like_user_message=True)
111
 
apps/gradio-app/src/fitness_gradio/ui/components.py CHANGED
@@ -167,7 +167,8 @@ class UIComponents:
167
  autoplay=True,
168
  show_download_button=True,
169
  show_share_button=False,
170
- format="wav" # Explicitly set format to WAV
 
171
  )
172
 
173
  @staticmethod
 
167
  autoplay=True,
168
  show_download_button=True,
169
  show_share_button=False,
170
+ format="wav", # Explicitly set format to WAV
171
+ visible=False # Initially hidden, will show when TTS is enabled
172
  )
173
 
174
  @staticmethod
apps/gradio-app/src/fitness_gradio/ui/handlers.py CHANGED
@@ -481,6 +481,19 @@ Please check your API keys and try a different model."""
481
  logger.info("Conversation history cleared")
482
  return []
483
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  @staticmethod
485
  def _generate_tts_for_response_sync(text: str) -> Optional[str]:
486
  """
 
481
  logger.info("Conversation history cleared")
482
  return []
483
 
484
+ @staticmethod
485
+ def toggle_audio_visibility(tts_enabled: bool) -> gr.Audio:
486
+ """
487
+ Toggle the visibility of the audio component based on TTS setting.
488
+
489
+ Args:
490
+ tts_enabled: Whether TTS is enabled
491
+
492
+ Returns:
493
+ Updated audio component with appropriate visibility
494
+ """
495
+ return gr.Audio(visible=tts_enabled)
496
+
497
  @staticmethod
498
  def _generate_tts_for_response_sync(text: str) -> Optional[str]:
499
  """