Spaces:
Sleeping
Sleeping
Update space
Browse files- README copy.md +0 -50
- README.md +50 -1
- chatbot.py +5 -1
- requirements.txt +1 -4
README copy.md
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
# Gaslighting Chatbot
|
2 |
-
|
3 |
-
## Description
|
4 |
-
๊ฐ์ค๋ผ์ดํ
์ฑ๋ด ํ๋ก์ ํธ
|
5 |
-
|
6 |
-
## Prerequisites
|
7 |
-
- Python 3.7 or higher
|
8 |
-
- pip (Python package installer)
|
9 |
-
|
10 |
-
## Setup Instructions
|
11 |
-
|
12 |
-
1. Clone the repository:
|
13 |
-
```sh
|
14 |
-
git clone <repository_url>
|
15 |
-
cd <repository_directory>
|
16 |
-
```
|
17 |
-
|
18 |
-
2. Create a virtual environment (optional but recommended):
|
19 |
-
```sh
|
20 |
-
python -m venv venv
|
21 |
-
source venv/bin/activate # On Windows: venv\Scripts\activate
|
22 |
-
```
|
23 |
-
|
24 |
-
3. Install the required packages:
|
25 |
-
```sh
|
26 |
-
pip install -r requirements.txt
|
27 |
-
```
|
28 |
-
|
29 |
-
4. Create a `.env` file in the project root directory and add your OpenAI API key:
|
30 |
-
```plaintext
|
31 |
-
OPENAI_API_KEY=sk-YourOpenAIKeyHere
|
32 |
-
```
|
33 |
-
๋ณ๋์ openai api๋ฅผ ํ์๋ก ํฉ๋๋ค.
|
34 |
-
|
35 |
-
5. Add `.env` to `.gitignore` to ensure it is not tracked by git:
|
36 |
-
```plaintext
|
37 |
-
# .gitignore
|
38 |
-
.env
|
39 |
-
```
|
40 |
-
|
41 |
-
6. Run the chatbot:
|
42 |
-
HICํด๋ ๋ด๋ถ์ V1~Vx๊น์ง ๊ฐ๋ฅ
|
43 |
-
|
44 |
-
## File Descriptions
|
45 |
-
|
46 |
-
- `chatbot.py`: The main script to run the chatbot.
|
47 |
-
- `requirements.txt`: Lists the dependencies required for the project.
|
48 |
-
- `.env`: File to store environment variables (e.g., API keys). **Do not commit this file to version control.**
|
49 |
-
- `.gitignore`: Ensures `.env` and other files are not tracked by git.
|
50 |
-
- `README.md`: This readme file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
@@ -10,4 +10,53 @@ pinned: false
|
|
10 |
license: unknown
|
11 |
---
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
license: unknown
|
11 |
---
|
12 |
|
13 |
+
# Gaslighting Chatbot
|
14 |
+
|
15 |
+
## Description
|
16 |
+
๊ฐ์ค๋ผ์ดํ
์ฑ๋ด ํ๋ก์ ํธ
|
17 |
+
|
18 |
+
## Prerequisites
|
19 |
+
- Python 3.7 or higher
|
20 |
+
- pip (Python package installer)
|
21 |
+
|
22 |
+
## Setup Instructions
|
23 |
+
|
24 |
+
1. Clone the repository:
|
25 |
+
```sh
|
26 |
+
git clone <repository_url>
|
27 |
+
cd <repository_directory>
|
28 |
+
```
|
29 |
+
|
30 |
+
2. Create a virtual environment (optional but recommended):
|
31 |
+
```sh
|
32 |
+
python -m venv venv
|
33 |
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
34 |
+
```
|
35 |
+
|
36 |
+
3. Install the required packages:
|
37 |
+
```sh
|
38 |
+
pip install -r requirements.txt
|
39 |
+
```
|
40 |
+
|
41 |
+
4. Create a `.env` file in the project root directory and add your OpenAI API key:
|
42 |
+
```plaintext
|
43 |
+
OPENAI_API_KEY=sk-YourOpenAIKeyHere
|
44 |
+
```
|
45 |
+
๋ณ๋์ openai api๋ฅผ ํ์๋ก ํฉ๋๋ค.
|
46 |
+
|
47 |
+
5. Add `.env` to `.gitignore` to ensure it is not tracked by git:
|
48 |
+
```plaintext
|
49 |
+
# .gitignore
|
50 |
+
.env
|
51 |
+
```
|
52 |
+
|
53 |
+
6. Run the chatbot:
|
54 |
+
HICํด๋ ๋ด๋ถ์ V1~Vx๊น์ง ๊ฐ๋ฅ
|
55 |
+
|
56 |
+
## File Descriptions
|
57 |
+
|
58 |
+
- `chatbot.py`: The main script to run the chatbot.
|
59 |
+
- `requirements.txt`: Lists the dependencies required for the project.
|
60 |
+
- `.env`: File to store environment variables (e.g., API keys). **Do not commit this file to version control.**
|
61 |
+
- `.gitignore`: Ensures `.env` and other files are not tracked by git.
|
62 |
+
- `README.md`: This readme file.
|
chatbot.py
CHANGED
@@ -2,14 +2,18 @@ import os
|
|
2 |
import json
|
3 |
from datetime import datetime
|
4 |
from openai import OpenAI
|
|
|
5 |
from dotenv import load_dotenv
|
6 |
from scenario_handler import ScenarioHandler
|
7 |
|
8 |
# Initialize the OpenAI client
|
9 |
load_dotenv()
|
10 |
api_key = os.getenv('OPENAI_API_KEY')
|
11 |
-
client = OpenAI(api_key=api_key)
|
12 |
|
|
|
|
|
|
|
|
|
13 |
# ์ ์ญ ๋ํ ๊ธฐ๋ก ๋ฐ ScenarioHandler ์ธ์คํด์ค
|
14 |
global_history = []
|
15 |
scenario_handler = ScenarioHandler() # ์ ์ญ์ผ๋ก ScenarioHandler ์ธ์คํด์ค ์์ฑ
|
|
|
2 |
import json
|
3 |
from datetime import datetime
|
4 |
from openai import OpenAI
|
5 |
+
from huggingface_hub import InferenceClient
|
6 |
from dotenv import load_dotenv
|
7 |
from scenario_handler import ScenarioHandler
|
8 |
|
9 |
# Initialize the OpenAI client
|
10 |
load_dotenv()
|
11 |
api_key = os.getenv('OPENAI_API_KEY')
|
|
|
12 |
|
13 |
+
+ client = InferenceClient(
|
14 |
+
base_url=...,
|
15 |
+
api_key=...,
|
16 |
+
)
|
17 |
# ์ ์ญ ๋ํ ๊ธฐ๋ก ๋ฐ ScenarioHandler ์ธ์คํด์ค
|
18 |
global_history = []
|
19 |
scenario_handler = ScenarioHandler() # ์ ์ญ์ผ๋ก ScenarioHandler ์ธ์คํด์ค ์์ฑ
|
requirements.txt
CHANGED
@@ -1,4 +1 @@
|
|
1 |
-
|
2 |
-
openai
|
3 |
-
gradio=4.27.0
|
4 |
-
json
|
|
|
1 |
+
json
|
|
|
|
|
|