KARTE / README.md
shuhayas's picture
Merge changes from hf-deployment branch
5896fe9
metadata
title: KARTE - 音声カルテ分析
emoji: 🎯
colorFrom: red
colorTo: pink
sdk: docker
app_port: 7860
pinned: false

KARTE - Audio Analysis for Medical Records

KARTE is a powerful application that generates medical records and customer service analysis from audio data. It combines advanced speech recognition with natural language processing to provide comprehensive insights.

Features

  • 🎤 Audio Transcription: Converts audio files to text using OpenAI's Whisper model
  • 📊 Style Analysis: Evaluates customer service style and communication quality
  • 🔄 Flow Analysis: Analyzes conversation flow and structure
  • 📝 Medical Record Generation: Creates structured medical records from conversations
  • 🔒 Secure Authentication: Basic auth protection for sensitive data
  • 📥 Export Functionality: Download analysis reports in JSON format

Technology Stack

  • Streamlit: Web application framework
  • OpenAI Whisper: Speech-to-text transcription
  • Groq: Large language model for analysis
  • Python: Core programming language
  • Docker: Containerization

Environment Variables

Required environment variables:

  • BASIC_AUTH_USERNAME: Username for basic authentication
  • BASIC_AUTH_PASSWORD: Password for basic authentication
  • OPENAI_API_KEY: OpenAI API key for transcription
  • GROQ_API_KEY: Groq API key for analysis

Usage

  1. Access the application through Hugging Face Spaces
  2. Log in using the provided credentials
  3. Upload an audio file (supported formats: MP3, WAV, M4A)
  4. Wait for transcription and analysis
  5. Review the generated insights and medical record
  6. Download the complete analysis report

Deploying to Hugging Face Spaces

Option 1: Using Streamlit SDK (Recommended)

  1. Make sure your README.md has the correct metadata at the top: ```

    title: KARTE - 音声カルテ分析 emoji: 🎯 colorFrom: red colorTo: pink sdk: streamlit sdk_version: 1.32.2 app_file: main.py pinned: false

    
    
  2. Set up your environment variables in Hugging Face Spaces:

    • Go to your Space settings
    • Add the following secrets:
      • OPENAI_API_KEY
      • GROQ_API_KEY
      • BASIC_AUTH_USERNAME
      • BASIC_AUTH_PASSWORD
  3. Push your code to the Hugging Face repository:

    git add .
    git commit -m "Deploy Streamlit app"
    git push
    

Option 2: Using Docker (Advanced)

  1. Update your README.md metadata to use Docker: ```

    title: KARTE - 音声カルテ分析 emoji: 🎯 colorFrom: red colorTo: pink sdk: docker pinned: false

    
    
  2. Make sure your Dockerfile is properly configured:

    • Uses port 7860
    • Sets up a non-root user
    • Installs all dependencies including ffmpeg
    • Properly sets environment variables
  3. Set up your environment variables in Hugging Face Spaces as in Option 1

  4. Push your code to the Hugging Face repository:

    git add .
    git commit -m "Deploy Docker app"
    git push
    

Troubleshooting

If you encounter issues with deployment:

  1. Start with the diagnostic app:

    • Change the Dockerfile to use test_app.py instead of main.py
    • This will help identify environment and dependency issues
  2. Check the Spaces logs for errors:

    • Go to your Space → "Logs" tab
    • Look for any error messages related to missing dependencies or environment variables
  3. Common issues:

    • Missing environment variables
    • Missing system dependencies (like ffmpeg)
    • Incorrect port configuration
    • Memory or resource limitations

Development

To run locally:

  1. Clone the repository
  2. Install dependencies: pip install -r requirements.txt
  3. Set up environment variables
  4. Run the application: streamlit run main.py

License

This project is licensed under the MIT License.