Skip to content

Commit

Permalink
Loading Indicator for Image and TTS Generation (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinh-rahb authored Aug 12, 2023
1 parent 473414d commit ca6ddfd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ def handle_message(user_id, user_message):
image_resp = openai.Image.create(prompt=prompt, n=1, size=IMAGE_SIZE)
image_url = image_resp["data"][0]["url"]
return jsonify({
'text': 'Processing your image request...',
'cardsV2': [
{
'cardId': generate_unique_card_id(),
Expand Down Expand Up @@ -349,13 +350,13 @@ def handle_message(user_id, user_message):
if voice not in voices_data_dict:
return jsonify({'text': f"Sorry, I couldn't recognize the voice {voice}. Please choose a valid voice."})


prompt = ' '.join(parts[2:])
audio_url, error = text_to_speech(prompt, voice)

if audio_url:
# Return a card with the audio link in a button
return jsonify({
'text': 'Processing your TTS request...',
'cardsV2': [
{
'cardId': generate_unique_card_id(),
Expand Down

0 comments on commit ca6ddfd

Please sign in to comment.