-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Chatbot #537
base: main
Are you sure you want to change the base?
Added Chatbot #537
Changes from all commits
ebe034c
cd2a52f
182965e
7c8041a
0b422db
5fd6d74
94fd731
e6761b8
c38064b
f31fa9e
c98b3f4
443dd4e
b36c91c
a745fca
be6b1a5
44e08f7
15cbcaa
e875514
4362a01
6aa167c
411448c
d29087c
489330a
37dc45f
5d9fa2a
9515ea2
cab612c
24ffd78
00d4b7f
d2d1876
abe1c7f
bbcbd97
26b803e
2a34956
bc47e17
07292ac
32de7fa
6912e79
1bf94fb
74bc883
f4f42a6
8e3415f
4b11640
ed7afb3
9fafceb
cb999d0
670dad4
07388d7
498b3a1
4c43c01
a1fd5b7
39922b6
275b5fe
79f9b97
cdeb0fc
5740276
a0cd877
c115ccb
27e39b7
df8a154
1360023
78c8324
cb2799f
5d2f7dd
33c1a33
4e9270e
b781c8a
7fbb4f7
aaeace6
62f8b73
4697f3b
2bbbd54
90482d3
682accd
93f4148
aa9eb4a
bc60c75
fa88e64
e62a12b
4b337bf
dbc2c4b
ef7687e
62f1525
29db5d9
6b64eaa
618f2fe
e256c1e
90f1c51
afd5609
155ad69
e0a8650
6ac264d
8da5db5
a3e0bcd
ef23489
2171a12
8a33936
34d1ab6
5300b80
408584d
7333a69
83d2e15
df4aeba
3b6a684
8fbb271
75274af
40fefe1
f4233e1
647d085
3e9cc29
e4c15a6
0e2bfab
c1f3206
ff03124
aeec142
e47eec8
8ac0255
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
//do_not_put_quptes_around_values | ||
REACT_APP_BACKEND_URL= https://paws-backend.azurewebsites.net | ||
//do_not_put_quotes_around_values | ||
VITE_BACKEND_URL= https://paws-backend.azurewebsites.net | ||
|
||
//vapid | ||
REACT_APP_VAPID_KEY= your vapid key | ||
VITE_VAPID_KEY= your vapid key | ||
|
||
|
||
//google maps | ||
REACT_APP_GOOGLE_MAPS_API_KEY= your google maps api key | ||
VITE_GOOGLE_MAPS_API_KEY= your google maps api key | ||
|
||
//cloudinary(image upload) | ||
REACT_APP_CLOUDINARY_UPLOAD_URL= your cloudinary url | ||
REACT_APP_CLOUDINARY_UPLOAD_PRESET= your cloudinary preset | ||
VITE_CLOUDINARY_UPLOAD_URL= your cloudinary url | ||
VITE_CLOUDINARY_UPLOAD_PRESET= your cloudinary preset |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Bug report 🐞 | ||
description: File a bug report | ||
title: "🐞[Bug]: " | ||
labels: 'bug' | ||
body: | ||
- type: checkboxes | ||
id: existing-issue | ||
attributes: | ||
label: Is there an existing issue for this? | ||
description: Please search to see if an issue already exists for the bug you encountered. | ||
options: | ||
- label: I have searched the existing issues | ||
required: true | ||
- type: textarea | ||
id: what-happened | ||
attributes: | ||
label: Describe the bug | ||
description: A concise description of what you are experiencing. | ||
placeholder: Tell us what you see! | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: expected-behaviour | ||
attributes: | ||
label: Expected behavior | ||
description: A clear and concise description of what you expected to happen. | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: screenshots | ||
attributes: | ||
label: Add ScreenShots | ||
description: Add sufficient ScreenShots to explain your issue. | ||
- type: dropdown | ||
id: browsers | ||
attributes: | ||
label: What browsers are you seeing the problem on? | ||
multiple: true | ||
options: | ||
- Firefox | ||
- Chrome | ||
- Safari | ||
- Microsoft Edge | ||
- type: checkboxes | ||
id: terms | ||
attributes: | ||
label: Record | ||
options: | ||
- label: "I have read the Contributing Guidelines" | ||
required: true | ||
- label: "I'm a GSSOC'24 contributor" | ||
required: false | ||
- label: "I want to work on this issue" | ||
required: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: 📝 Documentation Update | ||
description: Improve Documentation | ||
title: "📝[Docs]: " | ||
labels: 'enhancement' | ||
body: | ||
- type: checkboxes | ||
id: existing-issue | ||
attributes: | ||
label: Is there an existing issue for this? | ||
description: Please search to see if an issue already exists for the updates you want to make. | ||
options: | ||
- label: I have searched the existing issues | ||
required: true | ||
- type: textarea | ||
id: issue-description | ||
attributes: | ||
label: Issue Description | ||
description: Please provide a clear description of the documentation update you are suggesting. | ||
placeholder: Describe the improvement or correction you'd like to see in the documentation. | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: suggested-change | ||
attributes: | ||
label: Suggested Change | ||
description: Provide details of the proposed change to the documentation. | ||
placeholder: Explain how the documentation should be updated or corrected. | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: rationale | ||
attributes: | ||
label: Rationale | ||
description: Why is this documentation update necessary or beneficial? | ||
placeholder: Explain the importance or reasoning behind the suggested change. | ||
validations: | ||
required: False | ||
- type: dropdown | ||
id: urgency | ||
attributes: | ||
label: Urgency | ||
description: How urgently do you believe this documentation update is needed? | ||
options: | ||
- High | ||
- Medium | ||
- Low | ||
default: 0 | ||
validations: | ||
required: true | ||
- type: checkboxes | ||
id: terms | ||
attributes: | ||
label: Record | ||
options: | ||
- label: "I have read the Contributing Guidelines" | ||
required: true | ||
- label: "I'm a GSSOC'24 contributor" | ||
required: false | ||
- label: "I want to work on this issue" | ||
required: false |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: 💡Feature Request | ||
description: Suggest a feature | ||
title: "💡[Feature]: " | ||
labels: "enhancement" | ||
body: | ||
- type: checkboxes | ||
id: existing-issue | ||
attributes: | ||
label: Is there an existing issue for this? | ||
description: Please search to see if an issue already exists for this feature. | ||
options: | ||
- label: I have searched the existing issues | ||
required: true | ||
- type: textarea | ||
id: feature-description | ||
attributes: | ||
label: Feature Description | ||
description: Please provide a detailed description of the feature you are requesting. | ||
placeholder: Describe the new feature or enhancement you'd like to see. | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: use-case | ||
attributes: | ||
label: Use Case | ||
description: How would this feature enhance your use of the project? | ||
placeholder: Describe a specific use case or scenario where this feature would be beneficial. | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: benefits | ||
attributes: | ||
label: Benefits | ||
description: What benefits would this feature bring to the project or community? | ||
placeholder: Explain the advantages of implementing this feature. | ||
- type: textarea | ||
id: screenShots | ||
attributes: | ||
label: Add ScreenShots | ||
description: If any... | ||
- type: dropdown | ||
id: priority | ||
attributes: | ||
label: Priority | ||
description: How important is this feature to you? | ||
options: | ||
- High | ||
- Medium | ||
- Low | ||
default: 0 | ||
validations: | ||
required: true | ||
- type: checkboxes | ||
id: terms | ||
attributes: | ||
label: Record | ||
options: | ||
- label: "I have read the Contributing Guidelines" | ||
required: true | ||
- label: "I'm a GSSOC'24 contributor" | ||
required: false | ||
- label: "I want to work on this issue" | ||
required: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Greetings | ||
|
||
on: | ||
issues: | ||
types: [opened] | ||
|
||
jobs: | ||
greeting: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
issues: write | ||
|
||
steps: | ||
- name: Add Comment to Opened Issue | ||
uses: actions/first-interaction@v1 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-message: | | ||
Hi there! Thanks for opening this issue. We appreciate your contribution to this open-source project. | ||
Please make sure to read [this issue](https://github.com/Innovateninjas/Paws-frontend/issues/342) for important guidelines. | ||
We aim to respond or assign your issue as soon as possible. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Sync Fork with Upstream | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Replace with your branch name | ||
workflow_dispatch: | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the fork repository | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.PAT }} | ||
repository: <your-org>/<fork-repo> # Replace with your fork repository | ||
|
||
- name: Add upstream repository | ||
run: git remote add upstream https://github.com/Innovateninjas/Paws-frontend.git | ||
|
||
- name: Fetch upstream | ||
run: git fetch upstream | ||
|
||
- name: Merge upstream changes | ||
run: git merge upstream/main # Replace with your branch name | ||
|
||
- name: Push changes to fork | ||
run: git push origin main # Replace with your branch name | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# AI_CHATBOT | ||
It is an Ai chatbot developed using natural language toolkit NLTK, pytorch | ||
I have developed this bot | ||
Feel free to update the intents.json to make the domain of the chatbot wider. | ||
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,53 @@ | ||||||||||||||||||||||
import random | ||||||||||||||||||||||
import json | ||||||||||||||||||||||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused import: The - import random Committable suggestion
Suggested change
|
||||||||||||||||||||||
|
||||||||||||||||||||||
import torch | ||||||||||||||||||||||
|
||||||||||||||||||||||
from model import NeuralNet | ||||||||||||||||||||||
from nltk_utils import bag_of_words, tokenize | ||||||||||||||||||||||
|
||||||||||||||||||||||
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') | ||||||||||||||||||||||
|
||||||||||||||||||||||
with open('intents.json', 'r') as json_data: | ||||||||||||||||||||||
intents = json.load(json_data) | ||||||||||||||||||||||
|
||||||||||||||||||||||
FILE = "data.pth" | ||||||||||||||||||||||
data = torch.load(FILE) | ||||||||||||||||||||||
|
||||||||||||||||||||||
input_size = data["input_size"] | ||||||||||||||||||||||
hidden_size = data["hidden_size"] | ||||||||||||||||||||||
output_size = data["output_size"] | ||||||||||||||||||||||
all_words = data['all_words'] | ||||||||||||||||||||||
tags = data['tags'] | ||||||||||||||||||||||
model_state = data["model_state"] | ||||||||||||||||||||||
|
||||||||||||||||||||||
model = NeuralNet(input_size, hidden_size, output_size).to(device) | ||||||||||||||||||||||
model.load_state_dict(model_state) | ||||||||||||||||||||||
model.eval() | ||||||||||||||||||||||
|
||||||||||||||||||||||
bot_name = "Snapitizer" | ||||||||||||||||||||||
print("Let's chat! (type 'quit' to exit)") | ||||||||||||||||||||||
while True: | ||||||||||||||||||||||
# sentence = "do you use credit cards?" | ||||||||||||||||||||||
sentence = input("You: ") | ||||||||||||||||||||||
if sentence == "quit": | ||||||||||||||||||||||
break | ||||||||||||||||||||||
Comment on lines
+30
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle case-insensitive 'quit' command. Currently, the 'quit' command is case-sensitive. Consider making it case-insensitive for better user experience. - if sentence == "quit":
+ if sentence.lower() == "quit": Committable suggestion
Suggested change
|
||||||||||||||||||||||
|
||||||||||||||||||||||
sentence = tokenize(sentence) | ||||||||||||||||||||||
X = bag_of_words(sentence, all_words) | ||||||||||||||||||||||
X = X.reshape(1, X.shape[0]) | ||||||||||||||||||||||
X = torch.from_numpy(X).to(device) | ||||||||||||||||||||||
|
||||||||||||||||||||||
output = model(X) | ||||||||||||||||||||||
_, predicted = torch.max(output, dim=1) | ||||||||||||||||||||||
|
||||||||||||||||||||||
tag = tags[predicted.item()] | ||||||||||||||||||||||
|
||||||||||||||||||||||
probs = torch.softmax(output, dim=1) | ||||||||||||||||||||||
prob = probs[0][predicted.item()] | ||||||||||||||||||||||
if prob.item() > 0.75: | ||||||||||||||||||||||
for intent in intents['intents']: | ||||||||||||||||||||||
if tag == intent["tag"]: | ||||||||||||||||||||||
print(f"{bot_name}: {random.choice(intent['responses'])}") | ||||||||||||||||||||||
else: | ||||||||||||||||||||||
print(f"{bot_name}: I do not understand...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve documentation clarity and fix grammatical issue.
The documentation can be enhanced for better readability. Additionally, there is a missing comma after "pytorch".
Committable suggestion
Tools
LanguageTool