Spaces:
Running
Running
add readme
Browse files
README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
---
|
2 |
title: Chatbot Mistral
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
colorTo: indigo
|
6 |
sdk: streamlit
|
7 |
sdk_version: 1.42.0
|
@@ -9,4 +9,44 @@ app_file: app.py
|
|
9 |
pinned: false
|
10 |
---
|
11 |
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
title: Chatbot Mistral
|
3 |
+
emoji: 😷
|
4 |
+
colorFrom: white
|
5 |
colorTo: indigo
|
6 |
sdk: streamlit
|
7 |
sdk_version: 1.42.0
|
|
|
9 |
pinned: false
|
10 |
---
|
11 |
|
12 |
+
# Symptom Diagnosis Chatbot
|
13 |
+
|
14 |
+
An interactive Python chatbot that helps users identify a possible diagnosis based on the symptoms they report. This project integrates a knowledge base stored in a `database.txt` file and utilizes HuggingFace models for generating responses and performing translations.
|
15 |
+
|
16 |
+
## Description
|
17 |
+
|
18 |
+
This project was created to:
|
19 |
+
- **Load a Knowledge Base:** A `database.txt` file contains symptoms and their corresponding content. Each record follows the format:
|
20 |
+
|
21 |
+
|
22 |
+
- **Generate Customized Responses:** Using the `Mistral-7B-Instruct-v0.3` model from HuggingFace to interpret the user's query and the `Helsinki-NLP/opus-mt-tc-big-en-pt` model to translate responses into Portuguese.
|
23 |
+
- **Provide an Interactive Web Interface:** Built with Streamlit, allowing users to interact with the chatbot and adjust parameters via a sidebar.
|
24 |
+
|
25 |
+
## Features
|
26 |
+
|
27 |
+
- **Knowledge Base Integration:** Reads and formats symptoms and content from an external file.
|
28 |
+
- **Response Generation:** Provides responses based on the conversation context and the knowledge base.
|
29 |
+
- **Automatic Translation:** Translates responses to Portuguese.
|
30 |
+
- **Interactive Web Interface:** Developed with Streamlit, enabling a simple and intuitive conversation with the chatbot.
|
31 |
+
- **Customizable Settings:** Allows adjustments to system messages, maximum response length, and other parameters through the interface.
|
32 |
+
|
33 |
+
## Prerequisites
|
34 |
+
|
35 |
+
- **Python 3.8 or higher**
|
36 |
+
- **HuggingFace Access Token:** Set the environment variable `HF_TOKEN` with your HuggingFace token.
|
37 |
+
- The following Python libraries:
|
38 |
+
- `streamlit`
|
39 |
+
- `transformers`
|
40 |
+
- `langchain-huggingface`
|
41 |
+
- (Other dependencies may be listed in a `requirements.txt` file)
|
42 |
+
|
43 |
+
## Installation
|
44 |
+
|
45 |
+
1. **Clone the Repository**
|
46 |
+
|
47 |
+
2. **Install requirements**
|
48 |
+
```bash
|
49 |
+
pip install -r requirements.txt
|
50 |
+
```
|
51 |
+
|
52 |
+
**Highly recommend use hugginface spaces**
|
app.py
CHANGED
@@ -22,7 +22,7 @@ text_waiting_ai_response = "Pensando..."
|
|
22 |
max_response_length = 256
|
23 |
reset_button_label = "Reset Chat History"
|
24 |
chatbot_title = "ChatBot Sintomas"
|
25 |
-
chatbot_description = f"* Um chatbot de sintomas que usa os modelos {model_id} e {translation_model_id}.*"
|
26 |
temperature = 0.1
|
27 |
|
28 |
translation_pipeline = pipeline(
|
|
|
22 |
max_response_length = 256
|
23 |
reset_button_label = "Reset Chat History"
|
24 |
chatbot_title = "ChatBot Sintomas"
|
25 |
+
chatbot_description = f"* Um chatbot de sintomas que usa os modelos {model_id} e {translation_model_id}.* Lembre-se de não confiar nesse chatbot, para casos reais um médico deverá ser consultado."
|
26 |
temperature = 0.1
|
27 |
|
28 |
translation_pipeline = pipeline(
|