mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-27 14:01:09 +00:00
Merge 68a30475d3
into f0ea440d41
This commit is contained in:
commit
a54d57bb02
11
ChatBot Using ChatterBot/Pipfile
Normal file
11
ChatBot Using ChatterBot/Pipfile
Normal file
|
@ -0,0 +1,11 @@
|
|||
[[source]]
|
||||
name = "pypi"
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
|
||||
[dev-packages]
|
||||
|
||||
[packages]
|
||||
|
||||
[requires]
|
||||
python_version = "3.7"
|
4
ChatBot Using ChatterBot/Requirements.txt
Normal file
4
ChatBot Using ChatterBot/Requirements.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
flask
|
||||
ChatterBot
|
||||
Spacy
|
||||
Numpy
|
33
ChatBot Using ChatterBot/file.txt
Normal file
33
ChatBot Using ChatterBot/file.txt
Normal file
|
@ -0,0 +1,33 @@
|
|||
"Hello",
|
||||
"Hi there!",
|
||||
"Hi",
|
||||
"Hi!",
|
||||
"How are you doing?",
|
||||
"I'm doing great.",
|
||||
"That is good to hear",
|
||||
"Thank you.",
|
||||
"You're welcome.",
|
||||
'What is your name?', 'My name is Resume ChatBot',
|
||||
'Who created you?', 'Sunanda'
|
||||
"Tell me about yourself",
|
||||
"My name is Sunanda Somwase. I am a third year computer engineering student at PVGCOET",
|
||||
"Contact",
|
||||
"Email : sunandasomwase@gmail.com, Mobile number : +91 9021393816 Location : Pune, Maharashtra",
|
||||
"Education",
|
||||
"Bachelor of Engineering (B.E), '\n'
|
||||
Computer Science & Engineering\n
|
||||
Pune Vidyarthi Grihas College Of Engineering And Technology Pune '\n'
|
||||
2018 - 2022 '\n'
|
||||
CGPA: 8.84/10 '\n'
|
||||
Senior Secondary (XII), Science
|
||||
Sir Parashurambhau College Pune Maharashtra
|
||||
(MAHARASHTRA STATE BOARD board)
|
||||
Year of completion: 2018
|
||||
Percentage: 88.40%
|
||||
Secondary (X)
|
||||
Sant Meera School Aurangabad
|
||||
(MAHARASHTRA STATE BOARF board)
|
||||
Year of completion: 2016
|
||||
Percentage: 96.20%",
|
||||
"Projects",
|
||||
""
|
25
ChatBot Using ChatterBot/myapp.py
Normal file
25
ChatBot Using ChatterBot/myapp.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
from flask import Flask, render_template, request
|
||||
from chatterbot import ChatBot
|
||||
from chatterbot.trainers import ChatterBotCorpusTrainer
|
||||
from chatterbot.trainers import ListTrainer
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
with open('file.txt','r') as file:
|
||||
conversation = file.read()
|
||||
|
||||
bot = ChatBot("Sunanda's Resume ChatBot")
|
||||
trainer = ListTrainer(bot)
|
||||
trainer.train(conversation)
|
||||
|
||||
@app.route("/")
|
||||
def home():
|
||||
return render_template("home.html")
|
||||
|
||||
@app.route("/get")
|
||||
def get_bot_response():
|
||||
userText = request.args.get('msg')
|
||||
return str(bot.get_response(userText))
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
145
ChatBot Using ChatterBot/templates/home.html
Normal file
145
ChatBot Using ChatterBot/templates/home.html
Normal file
|
@ -0,0 +1,145 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<title>Candice</title>
|
||||
<head>
|
||||
<link
|
||||
rel="shortcut icon"
|
||||
type="image/x-icon"
|
||||
href="https://user-images.githubusercontent.com/20112458/49326597-773b7280-f57a-11e8-853d-20ed61d18b0d.png"
|
||||
/>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
|
||||
<style>
|
||||
body {
|
||||
font-family: monospace;
|
||||
}
|
||||
h1 {
|
||||
background-color: #FFC9BE;
|
||||
display: inline-block;
|
||||
font-size: 3em;
|
||||
margin: 0;
|
||||
padding: 14px;
|
||||
}
|
||||
h3 {
|
||||
color: black;
|
||||
font-size: 20px;
|
||||
margin-top: 3px;
|
||||
text-align: center;
|
||||
}
|
||||
#chatbox {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 40%;
|
||||
margin-top: 60px;
|
||||
}
|
||||
#userInput {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 40%;
|
||||
margin-top: 60px;
|
||||
}
|
||||
#textInput {
|
||||
width: 90%;
|
||||
border: none;
|
||||
border-bottom: 3px solid black;
|
||||
font-family: monospace;
|
||||
font-size: 17px;
|
||||
}
|
||||
.userText {
|
||||
color: black;
|
||||
font-family: monospace;
|
||||
font-size: 17px;
|
||||
text-align: right;
|
||||
line-height: 30px;
|
||||
}
|
||||
.userText span {
|
||||
background-color: #FDFF60;
|
||||
padding: 10px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.botText {
|
||||
color: black;
|
||||
font-family: monospace;
|
||||
font-size: 17px;
|
||||
text-align: left;
|
||||
line-height: 30px;
|
||||
}
|
||||
.botText span {
|
||||
background-color: #BEE3FF;
|
||||
padding: 10px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
#tidbit {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
width: 300px;
|
||||
}
|
||||
.boxed {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 78%;
|
||||
margin-top: 60px;
|
||||
border: 1px solid green;
|
||||
}
|
||||
.box {
|
||||
border: 2px solid black;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<img />
|
||||
<center>
|
||||
<h1>
|
||||
<img
|
||||
src="https://www.logolynx.com/images/logolynx/s_b9/b9075efd5754f8eb0b28894bbff5f1f0.jpeg"
|
||||
alt="CANDICE"
|
||||
style="width:50px;height:50px;"
|
||||
/>Sunanda's Resume ChatBot
|
||||
</h1>
|
||||
</center>
|
||||
<div class="box"></div>
|
||||
<div class="boxed">
|
||||
<div>
|
||||
<div id="chatbox">
|
||||
<img
|
||||
src="https://www.logolynx.com/images/logolynx/s_b9/b9075efd5754f8eb0b28894bbff5f1f0.jpeg"
|
||||
alt="CANDICE"
|
||||
style="width:50px;height:50px;"
|
||||
/>
|
||||
<p class="botText">
|
||||
<span>Hello there! I am Sunanda's Resume ChatBot</span>
|
||||
</p>
|
||||
</div>
|
||||
<div id="userInput">
|
||||
<input id="textInput" type="text" name="msg" placeholder="Message" />
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function getBotResponse() {
|
||||
var rawText = $("#textInput").val();
|
||||
var userHtml = '<p class="userText"><span>' + rawText + "</span></p>";
|
||||
$("#textInput").val("");
|
||||
$("#chatbox").append(userHtml);
|
||||
document
|
||||
.getElementById("userInput")
|
||||
.scrollIntoView({ block: "start", behavior: "smooth" });
|
||||
$.get("/get", { msg: rawText }).done(function(data) {
|
||||
var botHtml = '<p class="botText"><span>' + data + "</span></p>";
|
||||
$("#chatbox").append(botHtml);
|
||||
document
|
||||
.getElementById("userInput")
|
||||
.scrollIntoView({ block: "start", behavior: "smooth" });
|
||||
});
|
||||
}
|
||||
$("#textInput").keypress(function(e) {
|
||||
if (e.which == 13) {
|
||||
getBotResponse();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user