chatbot-sverige / README.md
organicoder's picture
Update README.md
92c50a5 verified

A newer version of the Gradio SDK is available: 5.49.1

Upgrade
metadata
title: AI Chatbot
emoji: πŸ€–
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.36.2
app_file: app_simple.py
pinned: false

AI Chatbot with PDF Knowledge

A smart AI chatbot built with Gradio and OpenAI's GPT models, enhanced with PDF document knowledge. The chatbot can answer questions based on the Health Tech Hub Copenhagen PDF document, making it perfect for health tech inquiries and information retrieval.

Features

  • πŸ€– Powered by OpenAI's GPT-3.5-turbo
  • πŸ“„ PDF Knowledge Integration - Answers based on Health Tech Hub Copenhagen document
  • πŸ” Semantic Search - Finds relevant information from the PDF
  • πŸ’¬ Real-time chat interface
  • 🎨 Beautiful and responsive UI
  • πŸ“± Mobile-friendly design
  • πŸ”„ Conversation history
  • 🧹 Clear chat functionality

Local Development

Prerequisites

  • Python 3.8 or higher
  • OpenAI API key

Installation

  1. Clone this repository:
git clone <your-repo-url>
cd chatbotsverige
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up your OpenAI API key:
export OPENAI_API_KEY="your-api-key-here"
  1. Run the application:
python app_simple.py

The chatbot will be available at http://localhost:7860

Deployment on Hugging Face Spaces

Method 1: Using the Hugging Face Web Interface

  1. Go to Hugging Face Spaces
  2. Click "Create new Space"
  3. Choose "Gradio" as the SDK
  4. Upload your files or connect your GitHub repository
  5. Add your OPENAI_API_KEY as a secret in the Space settings

Method 2: Using Git

  1. Create a new Space on Hugging Face
  2. Clone the Space repository:
git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
  1. Copy your files to the Space repository:
cp app_simple.py requirements.txt README.md "Health Tech Hub Copenhagen.pdf" /path/to/space/repo/
  1. Push to Hugging Face:
cd /path/to/space/repo/
git add .
git commit -m "Initial commit"
git push

Environment Variables

Make sure to set the following environment variable in your Hugging Face Space:

  • OPENAI_API_KEY: Your OpenAI API key

Configuration

You can customize the chatbot by modifying the following parameters in app_simple.py:

  • Model: Change gpt-3.5-turbo to other OpenAI models
  • Max tokens: Adjust max_tokens for response length
  • Temperature: Modify temperature for response creativity (0.0-1.0)
  • System prompt: Customize the system message for different personalities

Usage

  1. Type your message in the text input
  2. Press Enter or click the send button
  3. The AI will respond based on the conversation context
  4. Use the "Clear Chat" button to start a new conversation

Security Notes

  • Never commit your API keys to version control
  • Use environment variables for sensitive information
  • Consider implementing rate limiting for production use

License

This project is open source and available under the MIT License.

Contributing

Feel free to submit issues and enhancement requests!