Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
python-dotenv
gradio_client==1.5.4
gradio==5.12.0
# huggingface_hub 1.x removed HfFolder class that Gradio 4.x requires
huggingface_hub<1.0.0
# Gradio 5.x has localhost accessibility check that fails in Docker containers
# Using stable 4.19.0 which works reliably in containerized environments
gradio_client==0.10.0
gradio==4.19.0
openai==1.37.0
httpx==0.27.2
tiktoken
Expand Down
14 changes: 12 additions & 2 deletions shortGPT/api_utils/eleven_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,18 @@ def get_voices(self):
headers = {'accept': 'application/json'}
if self.api_key:
headers['xi-api-key'] = self.api_key
response = requests.get(url, headers=headers)
self.voices = {voice['name']: voice['voice_id'] for voice in response.json()['voices']}
try:
response = requests.get(url, headers=headers)
data = response.json()
if 'voices' in data:
self.voices = {voice['name']: voice['voice_id'] for voice in data['voices']}
else:
# API returned an error (e.g., invalid key)
print(f"ElevenLabs API error: {data}")
self.voices = {}
except Exception as e:
print(f"Error fetching ElevenLabs voices: {e}")
self.voices = {}
return self.voices

def get_remaining_characters(self):
Expand Down