hf_voicebot / README.md
SreekarB's picture
Update README.md
07bd42a verified
metadata
title: Simple Speech Chatbot
emoji: 🎧
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
python_version: 3.12

Simple Speech-to-Speech Chatbot

A fluid, adaptive speech-to-speech chatbot specifically designed for Hugging Face Spaces. This bot simulates natural, flowing conversation with itself using AWS Bedrock's Nova Sonic model. Unlike most chatbots that rely on pre-scripted dialogues, this one dynamically evolves conversations using contextual understanding and natural language adaptation.

Features

  • Fluid Conversation: Generates dynamic, contextually appropriate dialogue
  • Topic Evolution: Naturally evolves and shifts between conversation topics
  • Adaptive Depth: Begins with surface-level dialogue and gradually explores topics more deeply
  • Emotional Variety: Incorporates different tones and emotional states for more natural interaction
  • No UI: Pure console-based output showing the simulated conversation
  • AWS Bedrock Nova Sonic: Uses high-quality Nova Sonic model for lifelike speech synthesis

Setup

AWS Credentials

To use this app, you must add your AWS credentials as secrets in your Hugging Face Space:

  1. Go to the Settings tab of your Space
  2. Scroll to "Repository secrets" section
  3. Add the following secrets:
    • AWS_ACCESS_KEY_ID: Your AWS access key with Bedrock permissions
    • AWS_SECRET_ACCESS_KEY: Your AWS secret access key
    • AWS_DEFAULT_REGION: (optional, defaults to us-east-1)

Your AWS account must have access to the Amazon Bedrock Nova Sonic model.

How It Works

  1. The app automatically starts when your Space launches
  2. The AI begins with a greeting: "Hi there! I'm your AI conversation partner. How are you doing today? I'm here to chat about anything you'd like to discuss."
  3. The app intelligently generates contextual responses based on the conversation state and history
  4. The bot dynamically evolves the conversation across multiple topic areas:
    • Daily life (technology, arts, travel, food, health)
    • Future thinking (technology, environment, society, personal growth)
    • Creative exploration (books, films, music, visual arts, games)
    • World understanding (science, philosophy, history, culture, psychology)
  5. No user interaction is needed - just watch the dynamic conversation unfold

Demo Output

Example of what you'll see when the app is running:

Starting conversation...

You: Hi there! I'm your AI conversation partner. How are you doing today? I'm here to chat about anything you'd like to discuss.

AI: Hello! I'm doing quite well, thanks for asking. It's always a pleasure to chat with someone new. How are you doing today? Is there anything specific you'd like to talk about, or shall we just have a casual conversation?

You: I've been thinking about artificial intelligence in the near future lately.

AI: That's a fascinating topic! The near future of AI is likely to bring some remarkable changes to our daily lives. I'm particularly intrigued by the potential for AI to augment human creativity rather than replace it. Do you see AI as mostly beneficial, or are you concerned about some of the risks that might come with these advances?

You: I see your point about how AI can enhance creativity. That makes me wonder about what makes music truly memorable?

AI: That's a thoughtful question! What makes music memorable is such a subjective and multi-layered experience. For me, memorable music often creates an emotional connection - whether it's nostalgia, joy, or even melancholy. There's also something powerful about unexpected harmonies or lyrics that perfectly capture a feeling we couldn't articulate ourselves. The cultural context matters too; sometimes a song becomes memorable because of when and where we first experienced it. What kinds of music tend to stick with you the longest?

...conversation continues naturally evolving...

Customization

You can customize the conversation intelligence by modifying these elements in app.py:

  • INITIAL_GREETING: The first message from the AI
  • CONVERSATION_CONTEXTS: The topic areas and contextual elements that guide conversation flow
  • Content generators (methods starting with _generate_): Functions that create contextually relevant content
  • System prompt (line 218): Personality instructions for the AI model

License

MIT Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference