mgbam commited on
Commit
43f3d61
·
verified ·
1 Parent(s): 3a39257

Update deployer/gradio_generator.py

Browse files
Files changed (1) hide show
  1. deployer/gradio_generator.py +3 -3
deployer/gradio_generator.py CHANGED
@@ -8,8 +8,7 @@ from openai import OpenAI
8
  # Initialize OpenAI client for transcription
9
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
10
  if not OPENAI_API_KEY:
11
- raise EnvironmentError("Please set the OPENAI_API_KEY environment variable for audio transcription.
12
- ")
13
  openai_client = OpenAI(api_key=OPENAI_API_KEY)
14
 
15
 
@@ -33,7 +32,7 @@ def robot_behavior(user_input: str) -> str:
33
  bot = VirtualRobot()
34
  text = user_input.strip().lower()
35
 
36
- # Greeting detection: wave + friendly greeting
37
  if any(greet in text for greet in ["hello", "hi", "hey", "welcome"]):
38
  return bot.perform_action("wave") + "\n" + bot.perform_action("say Hello there!")
39
 
@@ -78,6 +77,7 @@ def launch_gradio_app(
78
  )
79
 
80
  gr.Markdown("---")
 
81
  # Voice input section
82
  audio_input = gr.Audio(
83
  source="microphone",
 
8
  # Initialize OpenAI client for transcription
9
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
10
  if not OPENAI_API_KEY:
11
+ raise EnvironmentError("Please set the OPENAI_API_KEY environment variable for audio transcription.")
 
12
  openai_client = OpenAI(api_key=OPENAI_API_KEY)
13
 
14
 
 
32
  bot = VirtualRobot()
33
  text = user_input.strip().lower()
34
 
35
+ # Greeting detection
36
  if any(greet in text for greet in ["hello", "hi", "hey", "welcome"]):
37
  return bot.perform_action("wave") + "\n" + bot.perform_action("say Hello there!")
38
 
 
77
  )
78
 
79
  gr.Markdown("---")
80
+
81
  # Voice input section
82
  audio_input = gr.Audio(
83
  source="microphone",