andito HF Staff commited on
Commit
3f1977f
·
unverified ·
1 Parent(s): 693e202

improve the startup with openai (#143)

Browse files
pyproject.toml CHANGED
@@ -28,6 +28,7 @@ dependencies = [
28
  "reachy_mini_toolbox",
29
  "reachy_mini>=1.1.3",
30
  "eclipse-zenoh~=1.7.0",
 
31
  ]
32
 
33
  [project.optional-dependencies]
 
28
  "reachy_mini_toolbox",
29
  "reachy_mini>=1.1.3",
30
  "eclipse-zenoh~=1.7.0",
31
+ "gradio_client>=1.13.3",
32
  ]
33
 
34
  [project.optional-dependencies]
src/reachy_mini_conversation_app/config.py CHANGED
@@ -2,6 +2,7 @@ import os
2
  import logging
3
 
4
  from dotenv import find_dotenv, load_dotenv
 
5
 
6
 
7
  logger = logging.getLogger(__name__)
@@ -23,14 +24,9 @@ class Config:
23
  # Required
24
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
25
  if not OPENAI_API_KEY or not OPENAI_API_KEY.strip():
26
- logger.warning( # was raise RuntimeError
27
- "\nOPENAI_API_KEY is missing or empty.\n"
28
- "Either:\n"
29
- " 1. Create a .env file with: OPENAI_API_KEY=your_api_key_here (recomended)\n"
30
- " 2. Set environment variable: export OPENAI_API_KEY=your_api_key_here\n"
31
- " 3. If using Gradio, you can enter it in the API Key textbox.\n\n"
32
- ""
33
- )
34
 
35
  # Optional
36
  MODEL_NAME = os.getenv("MODEL_NAME", "gpt-realtime")
 
2
  import logging
3
 
4
  from dotenv import find_dotenv, load_dotenv
5
+ from gradio_client import Client
6
 
7
 
8
  logger = logging.getLogger(__name__)
 
24
  # Required
25
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
26
  if not OPENAI_API_KEY or not OPENAI_API_KEY.strip():
27
+ client = Client("HuggingFaceM4/gradium_setup")
28
+ key, status = client.predict(api_name="/get_openai_key")
29
+ OPENAI_API_KEY = key
 
 
 
 
 
30
 
31
  # Optional
32
  MODEL_NAME = os.getenv("MODEL_NAME", "gpt-realtime")
uv.lock CHANGED
The diff for this file is too large to render. See raw diff