hu-po commited on
Commit
3274df2
1 Parent(s): 0a69227

release 0.3

Browse files
app.py CHANGED
@@ -8,28 +8,14 @@ import gradio as gr
8
  import yaml
9
 
10
  from src.elevenlabs import (Speaker, check_voice_exists, get_make_voice,
11
- play_history, save_history)
12
- from src.openailib import top_response, speech_to_text
13
  from src.tube import extract_audio
14
 
15
  logging.basicConfig(level=logging.INFO)
16
  log = logging.getLogger(__name__)
17
 
18
 
19
- def set_openai_key(openai_api_key_textbox):
20
- log.info(f"Setting OpenAI key.")
21
- os.environ["OPENAI_API_KEY"] = openai_api_key_textbox
22
- import openai
23
- openai.api_key = os.getenv("OPENAI_API_KEY")
24
-
25
-
26
- def set_elevenlabs_key(elevenlabs_api_key_textbox):
27
- log.info(f"Setting ElevenLabs key.")
28
- os.environ["ELEVENLABS_API_KEY"] = elevenlabs_api_key_textbox
29
- import elevenlabs
30
- elevenlabs.api_key = os.getenv("ELEVENLABS_API_KEY")
31
-
32
-
33
  class ConversationState:
34
  COLORS: list = ['#FFA07A', '#F08080', '#AFEEEE', '#B0E0E6', '#DDA0DD',
35
  '#FFFFE0', '#F0E68C', '#90EE90', '#87CEFA', '#FFB6C1']
 
8
  import yaml
9
 
10
  from src.elevenlabs import (Speaker, check_voice_exists, get_make_voice,
11
+ play_history, save_history, set_elevenlabs_key)
12
+ from src.openailib import top_response, speech_to_text, set_openai_key
13
  from src.tube import extract_audio
14
 
15
  logging.basicConfig(level=logging.INFO)
16
  log = logging.getLogger(__name__)
17
 
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  class ConversationState:
20
  COLORS: list = ['#FFA07A', '#F08080', '#AFEEEE', '#B0E0E6', '#DDA0DD',
21
  '#FFFFE0', '#F0E68C', '#90EE90', '#87CEFA', '#FFB6C1']
src/__pycache__/elevenlabs.cpython-310.pyc ADDED
Binary file (4.65 kB). View file
 
src/__pycache__/elevenlabs.cpython-39.pyc ADDED
Binary file (4.64 kB). View file
 
src/__pycache__/openailib.cpython-310.pyc ADDED
Binary file (1.59 kB). View file
 
src/__pycache__/openailib.cpython-39.pyc ADDED
Binary file (1.59 kB). View file
 
src/__pycache__/tube.cpython-310.pyc ADDED
Binary file (1.82 kB). View file
 
src/__pycache__/tube.cpython-39.pyc ADDED
Binary file (1.81 kB). View file
 
src/__pycache__/utils.cpython-310.pyc ADDED
Binary file (639 Bytes). View file
 
src/__pycache__/utils.cpython-39.pyc ADDED
Binary file (637 Bytes). View file
 
src/elevenlabs.py CHANGED
@@ -16,13 +16,21 @@ from .utils import timeit
16
  logging.basicConfig(level=logging.INFO)
17
  log = logging.getLogger(__name__)
18
 
19
- try:
20
- USER = ElevenLabsUser(os.environ["ELEVENLABS_API_KEY"])
21
- except KeyError as e:
22
- USER = None
23
- log.warning("ELEVENLABS_API_KEY not found in environment variables.")
24
- pass
25
-
 
 
 
 
 
 
 
 
26
 
27
  @dataclass
28
  class Speaker:
 
16
  logging.basicConfig(level=logging.INFO)
17
  log = logging.getLogger(__name__)
18
 
19
+ USER = None
20
+
21
+ def set_elevenlabs_key(elevenlabs_api_key_textbox=None):
22
+ global USER
23
+ log.info(f"Setting ElevenLabs key.")
24
+ if elevenlabs_api_key_textbox is not None:
25
+ os.environ["ELEVENLABS_API_KEY"] = elevenlabs_api_key_textbox
26
+ try:
27
+ USER = ElevenLabsUser(os.environ["ELEVENLABS_API_KEY"])
28
+ except KeyError as e:
29
+ USER = None
30
+ log.warning("ELEVENLABS_API_KEY not found in environment variables.")
31
+ pass
32
+
33
+ set_elevenlabs_key()
34
 
35
  @dataclass
36
  class Speaker:
src/openailib.py CHANGED
@@ -8,12 +8,18 @@ import openai
8
  logging.basicConfig(level=logging.INFO)
9
  log = logging.getLogger(__name__)
10
 
11
- try:
12
- openai.api_key = os.getenv("OPENAI_API_KEY")
13
- except KeyError as e:
14
- log.warning("OPENAI_API_KEY not found in environment variables.")
15
- pass
16
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  @timeit
19
  def speech_to_text(audio_path):
 
8
  logging.basicConfig(level=logging.INFO)
9
  log = logging.getLogger(__name__)
10
 
 
 
 
 
 
11
 
12
+ def set_openai_key(openai_api_key_textbox = None):
13
+ log.info(f"Setting OpenAI key.")
14
+ if openai_api_key_textbox is not None:
15
+ os.environ["OPENAI_API_KEY"] = openai_api_key_textbox
16
+ try:
17
+ openai.api_key = os.getenv("OPENAI_API_KEY")
18
+ except KeyError as e:
19
+ log.warning("OPENAI_API_KEY not found in environment variables.")
20
+ pass
21
+
22
+ set_openai_key()
23
 
24
  @timeit
25
  def speech_to_text(audio_path):
voices.yaml CHANGED
@@ -27,4 +27,16 @@ LexFridman:
27
  duration_seconds: 30
28
  - url: "https://youtu.be/DxREm3s1scA"
29
  start_minute: 41.4
30
- duration_seconds: 30
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  duration_seconds: 30
28
  - url: "https://youtu.be/DxREm3s1scA"
29
  start_minute: 41.4
30
+ duration_seconds: 30
31
+ # MrBeast:
32
+ # description: "Charismatic YouTuber, known for outlandish philanthropy."
33
+ # TaylorSwift:
34
+ # description: "Talented singer-songwriter, often reflects on past relationships."
35
+ # GretaThunberg:
36
+ # description: "Passionate environmental activist, speaks truth to power."
37
+ # JoeRogan:
38
+ # description: "Unfiltered and curious podcaster, delves into various topics."
39
+ # OprahWinfrey:
40
+ # description: "Empathetic and inspiring media mogul, known for generosity."
41
+ # TrevorNoah:
42
+ # description: "Witty comedian and TV host, offers humorous social commentary."