Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
5.49.1
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
- Clone this repository:
git clone <your-repo-url>
cd chatbotsverige
- Install dependencies:
pip install -r requirements.txt
- Set up your OpenAI API key:
export OPENAI_API_KEY="your-api-key-here"
- 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
- Go to Hugging Face Spaces
- Click "Create new Space"
- Choose "Gradio" as the SDK
- Upload your files or connect your GitHub repository
- Add your
OPENAI_API_KEYas a secret in the Space settings
Method 2: Using Git
- Create a new Space on Hugging Face
- Clone the Space repository:
git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
- Copy your files to the Space repository:
cp app_simple.py requirements.txt README.md "Health Tech Hub Copenhagen.pdf" /path/to/space/repo/
- 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-turboto other OpenAI models - Max tokens: Adjust
max_tokensfor response length - Temperature: Modify
temperaturefor response creativity (0.0-1.0) - System prompt: Customize the system message for different personalities
Usage
- Type your message in the text input
- Press Enter or click the send button
- The AI will respond based on the conversation context
- 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!