binaryfarmer commited on
Commit
e72214d
·
1 Parent(s): 4b833f5

Delete chatbot

Browse files
chatbot/.dockerignore DELETED
@@ -1,27 +0,0 @@
1
- **/__pycache__
2
- **/.venv
3
- **/.classpath
4
- **/.dockerignore
5
- **/.env
6
- **/.git
7
- **/.gitignore
8
- **/.project
9
- **/.settings
10
- **/.toolstarget
11
- **/.vs
12
- **/.vscode
13
- **/*.*proj.user
14
- **/*.dbmdl
15
- **/*.jfm
16
- **/bin
17
- **/charts
18
- **/docker-compose*
19
- **/compose*
20
- **/Dockerfile*
21
- **/node_modules
22
- **/npm-debug.log
23
- **/obj
24
- **/secrets.dev.yaml
25
- **/values.dev.yaml
26
- LICENSE
27
- README.md
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
chatbot/.vscode/launch.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "configurations": [
3
- {
4
- "name": "Docker: Python - General",
5
- "type": "docker",
6
- "request": "launch",
7
- "preLaunchTask": "docker-run: debug",
8
- "python": {
9
- "pathMappings": [
10
- {
11
- "localRoot": "${workspaceFolder}",
12
- "remoteRoot": "/app"
13
- }
14
- ],
15
- "projectType": "general"
16
- }
17
- }
18
- ]
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
chatbot/.vscode/tasks.json DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "version": "2.0.0",
3
- "tasks": [
4
- {
5
- "type": "docker-build",
6
- "label": "docker-build",
7
- "platform": "python",
8
- "dockerBuild": {
9
- "tag": "chatbot:latest",
10
- "dockerfile": "${workspaceFolder}/Dockerfile",
11
- "context": "${workspaceFolder}",
12
- "pull": true
13
- }
14
- },
15
- {
16
- "type": "docker-run",
17
- "label": "docker-run: debug",
18
- "dependsOn": [
19
- "docker-build"
20
- ],
21
- "python": {
22
- "file": "src\\main.py"
23
- }
24
- }
25
- ]
26
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
chatbot/Chatbot/.gitattributes DELETED
@@ -1,34 +0,0 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tflite filter=lfs diff=lfs merge=lfs -text
29
- *.tgz filter=lfs diff=lfs merge=lfs -text
30
- *.wasm filter=lfs diff=lfs merge=lfs -text
31
- *.xz filter=lfs diff=lfs merge=lfs -text
32
- *.zip filter=lfs diff=lfs merge=lfs -text
33
- *.zst filter=lfs diff=lfs merge=lfs -text
34
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
chatbot/Chatbot/README.md DELETED
@@ -1,11 +0,0 @@
1
- ---
2
- title: Chatbot
3
- emoji: 📉
4
- colorFrom: yellow
5
- colorTo: yellow
6
- sdk: docker
7
- pinned: false
8
- license: mit
9
- ---
10
-
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
chatbot/Dockerfile DELETED
@@ -1,23 +0,0 @@
1
- # For more information, please refer to https://aka.ms/vscode-docker-python
2
- FROM python:3.10-slim
3
-
4
- # Keeps Python from generating .pyc files in the container
5
- ENV PYTHONDONTWRITEBYTECODE=1
6
-
7
- # Turns off buffering for easier container logging
8
- ENV PYTHONUNBUFFERED=1
9
-
10
- # Install pip requirements
11
- COPY requirements.txt .
12
- RUN python -m pip install -r requirements.txt
13
-
14
- WORKDIR /app
15
- COPY . /app
16
-
17
- # Creates a non-root user with an explicit UID and adds permission to access the /app folder
18
- # For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
19
- RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
20
- USER appuser
21
-
22
- # During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
23
- CMD ["python", "src\main.py"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
chatbot/docker-compose.debug.yml DELETED
@@ -1,11 +0,0 @@
1
- version: '3.4'
2
-
3
- services:
4
- chatbot:
5
- image: chatbot
6
- build:
7
- context: .
8
- dockerfile: ./Dockerfile
9
- command: ["sh", "-c", "pip install debugpy -t /tmp && python /tmp/debugpy --wait-for-client --listen 0.0.0.0:5678 src\main.py "]
10
- ports:
11
- - 5678:5678
 
 
 
 
 
 
 
 
 
 
 
 
chatbot/docker-compose.yml DELETED
@@ -1,8 +0,0 @@
1
- version: '3.4'
2
-
3
- services:
4
- chatbot:
5
- image: chatbot
6
- build:
7
- context: .
8
- dockerfile: ./Dockerfile
 
 
 
 
 
 
 
 
 
chatbot/requirements.txt DELETED
@@ -1 +0,0 @@
1
- # To ensure app dependencies are ported from your virtual environment/host machine into your container, run 'pip freeze > requirements.txt' in the terminal to overwrite this file
 
 
chatbot/src/listen.py DELETED
@@ -1,56 +0,0 @@
1
- import gradio as gr
2
- import openai
3
- import pyttsx3
4
-
5
- openai.api_key = "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"
6
-
7
- # Global variable to hold the chat history, initialise with system role
8
- conversation = [
9
- {"role": "system", "content": "You are an intelligent professor."}
10
- ]
11
-
12
- # transcribe function to record the audio input
13
-
14
- def transcribe(audio):
15
- print(audio)
16
-
17
- # Whisper API
18
-
19
- audio_file = open(audio, "rb")
20
- transcript = openai.Audio.transcribe("whisper-1", audio_file)
21
-
22
-
23
- print(transcript)
24
-
25
- # ChatGPT API
26
-
27
- # append user's inut to conversation
28
- conversation.append({"role": "user", "content": transcript["text"]})
29
-
30
- response = openai.ChatCompletion.create(
31
- model="gpt-3.5-turbo",
32
- messages=conversation
33
- )
34
-
35
- print(response)
36
-
37
- # system_message is the response from ChatGPT API
38
- system_message = response["choices"][0]["message"]["content"]
39
-
40
- # append ChatGPT response (assistant role) back to conversation
41
- conversation.append({"role": "assistant", "content": system_message})
42
-
43
-
44
- # Text to speech
45
- engine = pyttsx3.init()
46
- engine.setProperty("rate", 150)
47
- engine.setProperty("voice", "english-us")
48
- engine.save_to_file(system_message, "response.mp3")
49
- engine.runAndWait()
50
-
51
- return "response.mp3"
52
-
53
- # Gradio output
54
-
55
- bot = gr.Interface(fn=transcribe, inputs=gr.Audio(source="microphone", type="filepath"), outputs="audio")
56
- bot.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
chatbot/src/main.py DELETED
@@ -1,50 +0,0 @@
1
- import openai
2
- import pyttsx3
3
-
4
- openai.api_key = "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"
5
-
6
- # Global variable to hold the chat history, initialise with system role
7
- conversation = [
8
- {"role": "system", "content": "You are an intelligent professor."}
9
- ]
10
-
11
- # transcribe function to record the audio input
12
-
13
- def transcribe(audio):
14
- print(audio)
15
-
16
- # Whisper API
17
-
18
- audio_file = open(audio, "rb")
19
- transcript = openai.Audio.transcribe("whisper-1", audio_file)
20
-
21
-
22
- print(transcript)
23
-
24
- # ChatGPT API
25
-
26
- # append user's inut to conversation
27
- conversation.append({"role": "user", "content": transcript["text"]})
28
-
29
- response = openai.ChatCompletion.create(
30
- model="gpt-3.5-turbo",
31
- messages=conversation
32
- )
33
-
34
- print(response)
35
-
36
- # system_message is the response from ChatGPT API
37
- system_message = response["choices"][0]["message"]["content"]
38
-
39
- # append ChatGPT response (assistant role) back to conversation
40
- conversation.append({"role": "assistant", "content": system_message})
41
-
42
-
43
- # Text to speech
44
- engine = pyttsx3.init()
45
- engine.setProperty("rate", 150)
46
- engine.setProperty("voice", "english-us")
47
- engine.save_to_file(system_message, "response.mp3")
48
- engine.runAndWait()
49
-
50
- return "response.mp3"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
chatbot/src/requirements.txt DELETED
@@ -1,2 +0,0 @@
1
- openai==0.27.2
2
- pyttsx3