--- title: Chatbot Mimic Notes emoji: 🤖 colorFrom: blue colorTo: green sdk: gradio sdk_version: 3.50.2 app_file: chatgpt.py pinned: false license: mit python_version: 3.11 --- # Chatbot Mimic Notes A medical-focused chatbot that supports patient evaluations, structured conversation management, and optional Google Drive backups. > Need to customize the Hugging Face Space configuration? See the reference guide at https://huggingface.co/docs/hub/spaces-config-reference. ## Prerequisites - Python 3.x - pip ## Installation 1. Clone this repository 2. Navigate to the project directory: ``` cd chatbot-mimic-notes ``` 3. Install the required packages: ``` pip install -r requirements.txt ``` ## Running the Application Start the chatbot by running: ``` python chatgpt.py ``` ## Run Server ``` python -m src.server ``` ## Usage - Open Chrome and visit `http://localhost:7860` to interact with the chatbot. ## Google Drive Auto-Backup The chatbot can automatically push evaluation data to Google Drive so the latest files are available when deploying to Hugging Face. ### Storage Layout 1. **Patient evaluations** (`patient_evaluations/`) - Synced to the `Patient_Evaluations` folder in Drive - Includes per-evaluation JSON files plus the master CSV summary 2. **Conversation logs** (`user_data/`) - Synced to the `Chatbot_Conversations` folder in Drive - Includes conversation transcripts and memory graphs ### Configuration Options (choose one) #### ⭐ Option 1: Service Account (recommended) Use this if you see an `invalid_client` error or want a hands-off setup. 1. Create a Service Account in Google Cloud Console and download the JSON key 2. Share your destination Drive folder with the Service Account email 3. Update `google_drive_sync.py`: ```python SERVICE_ACCOUNT_FILE = "service-account-key.json" ``` **Full walkthrough (≈5 minutes):** see `QUICK_SETUP.md` #### Option 2: Refresh Token (requires an OAuth client) 1. Generate a refresh token: ```bash python get_refresh_token.py ``` 2. If you hit `invalid_client`, create a new OAuth client (see `QUICK_SETUP.md`) 3. Complete the browser authentication flow 4. Copy the printed `refresh_token` 5. Update `google_drive_sync.py`: ```python REFRESH_TOKEN = "your_refresh_token" ``` See `google_drive_setup_guide.md` or `QUICK_SETUP.md` for detailed steps. #### Option 3: Interactive OAuth (manual in UI) 1. Click **“Login to Google Drive”** inside the Gradio interface 2. Complete the browser authentication 3. Future saves will automatically sync to Drive ### Notes - Without authentication, all files remain in local storage - Upload failures are silent but local saves always succeed - Only your own Drive account receives files; no shared storage is involved - **Security:** never commit credentials or tokens into the repo