Rohan
Rohan
“Health ChatBot”
Submitted by
Mr.Rohan khandekar
[RollNo:CO 332]
[Enrollment no:2209950168]
Submitted by
Mr. Rohan
khandekar
[Roll No: CO
332]
Of Third Year Computer Engineering class in the partial fulfillment for the award of Diploma in
Computer Engineering program as per curriculum laid by the M.S.B.T.E., Mumbai during the
academic year 2023-2024.
Mr. T. L. Patil
(Mentor Signature and Name) (Program Coordinator, Comp. Engg. Dept.)
The objective of a practical training is to learn something about industries practically and
to be familiar with a working style of a technical worker to adjust simply according to
industrial environment. This report deals with the equipment their relation and their
general operating principle.
Python, an interpreted language which was created by Guido van Rossum, and released
in 1991.The language supports both object oriented and procedural oriented approach.
Python is designed to be a highly extensible language. Python works on the principle of
“there is only one obvious way to do a task” rather than “there is more than one way to
solve a particular problem”. Python is very easy to learn and implement. The simpler
syntax, uncomplicated semantics and approach with which python has been developed
makes it very easier to learn. A large number of python implementations and extensions
have been developed since its inception.
Training Covers seven weeks industrial training in Python.
ACKNOWLEDGEMENT
At the outset I would like to acknowledge our grateful thanks to our mentor from
Department of Computer Engineering for his valuable guidance and suggestions for our
project entitled. We would like to express our thanks to Mr. T.L. Patil, Head of
Department of Computer Science and Engineering for their great moral support.
We are thankful to Honorable Principal Dr. M.A. Chougule, A.G. Patil Polytechnic
Institute, Solapur for providing necessary facilities for completion of this work.
Last but not least we would like to thank to our all staff and friends for their advice and
support.
Thank You
Mr.Rohan khandekar
[Rollno:332]
Sr. No Content Page No.
Organizational Structure
Chapter 1 1
of Industry
Chapter 2 3
Introduction of Industry
Chapter 4 6
Development Processes
Chapter 5 7
Testing of Procedures
Software Handling
Chapter 6 8
Product and Procedure
Practical Experience in
Chapter 7 9
Industry
Chapter 8 11
Coding
The organizational structure of an industry refers to the way companies and businesses within
that industry are organized, coordinated, and managed. There are several common types of
organizational structures that can be found within industries, each with its own advantages,
disadvantages, and characteristics.
3. Matrix Structure: The matrix structure combines elements of both the functional and
divisional structures. Employees report to both functional managers and project managers This
allows for a balance between functional expertise and project-specific goals.
The choice of organizational structure depends on factors such as the industry's nature, the
organization's size, goals, culture, and the level of complexity involved in its operations.
Additionally, industries might adopt a hybrid approach, combining elements from different
structures to meet their specific needs. As industries evolve, so do their organizational structures
in response to new challenges, technologies, and market dynamics.
2|Page
Chapter 2: Introduction of Industry/Organization.
The software industry refers to the sector of the economy that involves the development,
production, distribution, and maintenance of computer software. Computer software consists of
programs, applications, and systems that run on various computing devices, from personal
computers and smartphones to servers and embedded systems.
Key aspects of the software industry include:
Software Development:
Software Products:
Software Services:
Open-Source Software:
Software as a Service (SaaS):
Platform as a Service (PaaS):
Software Distribution and Licensing:
Software Maintenance and Updates:
The software industry has experienced rapid growth and innovation due to advancements in
technology and increased reliance on digital solutions. It plays a vital role in various sectors,
including finance, healthcare, entertainment, education, manufacturing, and more. As technology
continues to evolve, the software industry adapts to new trends, such as artificial intelligence,
cloud computing, mobile applications, and the Internet of Things (IoT), to create innovative and
impactful software solutions.
PYTHON:
Python is a high-level, interpreted, interactive and object-oriented scripting language.
Python is designed to be highly readable. It uses English keywords frequently where as other
languages use punctuation, and it has fewer syntactical constructions than other languages.
Python is Interpreted
Python is Interactive
Python is Object-Oriented
Python is Object-Oriented
3|Page
History of Python:
Python was developed by Guido van Rossum in the late eighties and early nineties at the National
Research Institute for Mathematics and Computer Science in the Netherlands.
Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68,
SmallTalk, and Unix shell and other scripting languages.
Python is copyrighted. Like Perl, Python source code is now available under the GNU General
Public License (GPL).
Python is now maintained by a core development team at the institute, although Guido van Rossum
still holds a vital role in directing its progress.
Python Features:
Easy-to-learn
Easy-to-read
Easy-to-maintain
A broad standard library
Interactive Mode
Skills:
You will need:
An up-to-date knowledge and understanding of your employer's business and industry
needs, as well as the technical demands.
To recognize the importance of customer focus and/or of serving the needs of the end user.
Excellent communication skills, particularly the ability to communicate with staff
who aren't technically trained.
The skill to take on a variety of tasks and pay attention to detail.
Analytical and problem-solving ability.
Teamwork skills and the ability to feel comfortable working with different teams,
clients and Groups of staff across an organization.
4|Page
Chapter 3: Types of Equipment Used in Industry.
Personal Computer:
1. Use: A personal computer (PC) is a computing device designed for individual use.
It consists of various hardware components that work together to process
information, run software applications, and perform a variety of tasks.
2. Specification:
5|Page
Chapter 4: Development Processes.
Downloading:
1. If you don’t already have a copy of Python installed on your computer, you will
need to open up your Internet browser and go to the Python download page
(http://www.python.org/download/).
2. Now that you are on the download page, select which of the software builds you
would like to download. For the purposes of this article, we will use the most up
to date version available (Python 3.9.1) or above.
3. Once you have clicked on that, you will be taken to a page with a description of
all the new updates and features of 3.9.1, however, you can always read that while
the download is in process. Scroll to the bottom of the page till you find the
“Download” section and click on the link that says “download page.”
4. Now you will scroll all the way to the bottom of the page and find the “Windows
installer 32 bit.” If you want to download the 32-bit, feel free to do so. We believe
that even if you have a 64-bit operating system installed on your computer, the 64-
bit is preferable. We say this because it will still run well and sometimes, with the
64-bit architectures, some of the compiled binaries and Python libraries don’t
work well.
Installing Python:
1. Once you have downloaded the Python 3.9.1, simply navigate to the download
location on your computer, double clicking the file when the dialog box pops up.
After starting the installer, one of two options may be selected.
2. Select “Install Now” by default settings.
3. Setup Path of variables:
Begin by opening the start menu and typing in “environment” and select the
option called “Edit the system environment variables.” When the “System
Properties” window appears, click on “Environment Variables…” Once you have
the “Environment Variables” window open, direct your focus to the bottom half.
You will notice that it controls all the “System Variables” rather than just this
associated with your user. Click on “New…” to create a new variable for Python.
4. Running The Python IDE:
Now that we have successfully completed the installation process and added our
“Environment Variable,” you are ready to create your first basic Python script.
Let’s begin by opening Python’s by pressing “Start” and typing “Python” and
selecting the “IDLE (Python 3.9 64-bit).”
6|Page
Chapter 5: Testing of Components with Quality Assurance
Procedure.
7|Page
Chapter 6: Software Handling Product and Procedure.
Personal Computer:
3. Use: A personal computer (PC) is a computing device designed for individual use.
It consists of various hardware components that work together to process
information, run software applications, and perform a variety of tasks.
4. Specification:
8|Page
Chapter 7:Practical Experience in Industry.
Tuples:
A tuple is a collection of objects which ordered and immutable. Tuples are sequences,
just like lists. The differences between tuples and lists are, the tuples cannot be changed
unlike lists and tuples use parentheses, whereas lists use square brackets.
Creating a tuple is as simple as putting different comma-separated values. Optionally you
can put these comma-separated values between parentheses also. For example –
tup1 = ('physics', 'chemistry', 1997, 2000)
tup2 = (1, 2, 3, 4, 5)
tup3 = "a", "b", "c", "d"
Dictionary:
Each key is separated from its value by a colon (:), the items are separated by commas,
and the whole thing is enclosed in curly braces. An empty dictionary without any items is
written with just two curly braces, like this: { }.
Keys are unique within a dictionary while values may not be. The values of a dictionary
can be of any type, but the keys must be of an immutable data type such as strings,
numbers, or tuples.
To access dictionary elements, you can use the familiar square brackets along with the
key to obtain its value. Following is a simple example:
dict = {‘Name’:’Zara’,’Age’:7,’Class’:’First’} print(dict[‘Name’])
9|Page
Functions in Python:
A function is a block of organized, reusable code that is used to perform a single, related action.
Functions provide better modularity for your application and a high degree of code reusing. As
you already know, Python gives you many built-in functions like print(), etc. but you can also
create your own functions. These functions are called user-defined functions.
Defining a Function:
Simple rules to define a function in Python.
Function blocks begin with the keyword def followed by the function name and
parentheses (()).
Any input parameters or arguments should be placed within these parentheses. You can
also define parameters inside these parentheses.
The first statement of a function can be an optional statement - the documentation string
of the function or docstring.
The code block within every function starts with a colon (:) and is indented.
The statement return [expression] exits a function, optionally passing back an expression
to the caller. A return statement with no arguments is the same as return None.
Syntax:
def functionname(parameters):
function_suite
return [expression]
Example:
def printer(str):
print(str)
return
Calling a Function:
Defining a function gives it a name, specifies the parameters that are to be included in the
function and structures the blocks of code.
Once the basic structure of a function is finalized, you can execute it by calling it from another
function or directly from the Python prompt.
10 | P a g e
Chapter 8: Coding.
<div class="content">
<h1>Welcome to Heal Me Gini</h1>
<p>Your trusted assistant for Health and Wellness.</p>
<a href=" http://127.0.0.1:8000/input/" class="btn btn-light btn-chat">Chat with Heal Me Gini</a>
<div class="mt-4">
<h2>Health Information</h2>
<p>Access reliable health information and resources to manage your well-being.</p>
</div>
</div>
<footer class="footer">
<div class="container">
<p>© 2024 Heal Me Geni. All Rights Reserved.</p>
<div class="social-icons">
<a href="https://www.instagram.com" target="_blank"><i class="fab fa-instagram"></i></a>
<a href="https://www.facebook.com" target="_blank"><i class="fab fa-facebook-f"></i></a>
<a href="https://www.twitter.com" target="_blank"><i class="fab fa-twitter"></i></a>
<a href="https://www.youtube.com" target="_blank"><i class="fab fa-youtube"></i></a>
</div>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
12 | P a g e
</body>
</html>
Output:
About.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Heal Me Geni - Your Health Assistant</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
rel="stylesheet">
<style>
body {
background: white;
background-size: 100%
80%;
}
.section
{ background:
black; padding:
50px 0; text-align:
center; margin-top:
20px;
}
.section:nth-of-type(even) {
background: #f8f9fa;
13 | P a g e
}
.navbar {
14 | P a g e
background-color: rgba(0, 0, 0, 0.7);
}
.content {
text-align: center;
margin-top:
150px;
}
.footer {
background-color: rgba(0, 0, 0, 0.9);
color: #fff;
padding: 20px 0;
text-align: center;
position: fixed;
bottom: 0;
width: 100%;
}
.btn-chat {
margin-top: 20px;
}
.social-icons a
{ color: #fff;
margin: 0 10px;
font-size:
1.5em;
}
</style>
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark fixed-top">
<div class="container-fluid justify-content-center">
<a class="navbar-brand" href="http://127.0.0.1:8000/">"Heal Me Geni"</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-
target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-center" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link " aria-current="page" href="http://127.0.0.1:8000">Home</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="/about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/contact">Contact Us</a>
</li>
<li class="nav-item">
15 | P a g e
<a class="nav-link" href="/social">Social Media</a>
</li>
16 | P a g e
</ul>
</div>
</div>
</nav>
</div>
18 | P a g e
knowing that your health data is secure with us.</p>
</div>
<div class="col-md-5">
<img src="https://ideogram.ai/assets/progressive-image/balanced/response/Yuw9snIwQW2HZ9-
Ejfl1-Q" class="featurette-image img-fluid mx-auto" width="500" height="500" alt="Confidential and
Secure">
</div>
</div>
<hr class="featurette-divider">
<!-- /END THE FEATURETTES -->
</div>
<footer class="footer">
<div class="container">
<p>© 2024 Heal Me Geni. All Rights Reserved.</p>
<div class="social-icons">
<a href="https://www.instagram.com" target="_blank"><i class="fab fa-instagram"></i></a>
<a href="https://www.facebook.com" target="_blank"><i class="fab fa-facebook-f"></i></a>
<a href="https://www.twitter.com" target="_blank"><i class="fab fa-twitter"></i></a>
<a href="https://www.youtube.com" target="_blank"><i class="fab fa-youtube"></i></a>
</div>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Output:
19 | P a g e
Contact.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Heal Me Geni - Your Health Assistant</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-
beta3/css/all.min.css"rel="stylesheet">
<style>
.hero-section {
position: relative;
text-align: center;
color: white;
}
.hero-image {
width: 100%;
height: 300px;
object-fit:
cover;
filter: brightness(0.5);
}
.hero-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 3em;
}
body {
background-size: cover;
background-repeat: no-repeat;
background-attachment:
fixed; background-position:
center; height: 100vh;
margin: 0;
padding: 0;
20 | P a g e
color: #fff;
21 | P a g e
}
.navbar {
background-color: rgba(0, 0, 0, 0.7);
}
.content {
text-align: center;
margin-top:
150px;
}
.footer {
background-color: rgba(0, 0, 0, 0.9);
color: #fff;
padding: 20px 0;
text-align: center;
position: fixed;
bottom: 0;
width: 100%;
}
.btn-chat {
margin-top: 20px;
}
.social-icons a {
color: #fff;
margin: 0 10px;
font-size:
1.5em;
}
.contact-form {
background-color: rgba(255, 255, 255, 0.8);
padding: 20px;
border-radius: 8px;
color: #000;
}
.contact-form label {
color: #000;
}
.contact-form button {
background-color: #007bff;
color: #fff;
22 | P a g e
}
</syle>
23 | P a g e
<mea charset="UTF-8">
<scipt>
Function showMessage() {
alert("We have received your Query and we will try to resolve it thank you for giving your
valuabletime ");
}
</script>
</hea
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark fixed-top">
<div class="container-fluid justify-content-center">
<a class="navbar-brand" href="http://127.0.0.1:8000/">"Heal Me Geni"</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-
bstarget="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-center" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link " aria-current="page" href="http://127.0.0.1:8000">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about">About</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="/contact">Contact Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/social">Social Media</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="content">
{% if messages %}
<ul>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
25 | P a g e
Output:
Social.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Heal Me Geni - Your Health Assistant</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-
beta3/css/all.min.css"rel="stylesheet">
<style>
body {
background-image:url("https://image.freepik.com/free-vector/modern-background-social-
mediaicons_1017-4839.jpg");
background-size: cover;
background-repeat: no-repeat;
background-attachment:
fixed; background-position:
center; height: 100vh;
margin: 0;
padding: 0;
color: #fff;
}
26 | P a g e
.navbar {
background-color: rgba(0, 0, 0, 0.7);
}
.content {
text-align: center;
margin-top:
150px;
}
.footer {
background-color: rgba(0, 0, 0, 0.9);
color: #fff;
padding: 20px 0;
text-align: center;
position: fixed;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark fixed-top">
<div class="container-fluid justify-content-center">
<a class="navbar-brand" href="http://127.0.0.1:8000/">"Heal Me Geni"</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-
bstarget="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-center" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link " aria-current="page" href="http://127.0.0.1:8000">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/contact">Contact Us</a>
</li>
27 | P a g e
<li class="nav-item">
28 | P a g e
<a class="nav-link active" href="/social">Social Media</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="content">
<div>
<h2>Follow Us on Social Media</h2>
<p>Stay updated with the latest health tips and news.</p>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p>© 2024 Heal Me Geni. All Rights Reserved.</p>
<div class="social-icons">
<a href="https://www.instagram.com" target="_blank"><i class="fab fa-instagram"></i></a>
<a href="https://www.facebook.com" target="_blank"><i class="fab fa-facebook-f"></i></a>
<a href="https://www.twitter.com" target="_blank"><i class="fab fa-twitter"></i></a>
<a href="https://www.youtube.com" target="_blank"><i class="fab fa-youtube"></i></a>
</div>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Output:
29 | P a g e
Input.html:
<!DOCTYPE html>
<html lang="en">
<head
<eta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Input</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background: linear-gradient(to right, #667eea, #764ba2);
color: white;
height: 100vh;
display: flex;
overflow: hidden;
}
.sidebar {
width:
250px;
background-color: #ffffff; /* White background color for past chats */
padding: 20px;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0, 0, 0,
0.1); margin-right: 20px;
30 | P a g e
color: black; /* Black text color for better contrast */
31 | P a g e
position: absolute;
left: -270px; /* Initially hidden */
transition: left 0.3s ease-in-out;
}
.sidebar.open {
left: 0; /* Slide in */
}
.sidebar h2 {
font-size: 1.5rem;
margin-bottom:
20px;
}
.sidebar ul {
list-style-type: none;
padding: 0;
}
.sidebar ul li {
margin-bottom: 10px
}
.sidebar ul li button {
width: 100%;
text-align: left;
background-color: #f1f1f1; /* Light background color */
border: none;
padding: 10px;
border-radius: 5px;
color: black;
}
.sidebar ul li button:hover {
background-color: #ddd; /* Hover effect */
}
.input-container {
background-color: #ffffff;
padding: 30px;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0, 0, 0,
0.1); text-align: center;
flex: 1;
margin-left: 250px; /* Adjusted for sidebar
32 | P a g e
*/ overflow-y: auto; /* Add vertical scroll */
33 | P a g e
}
.input-container h1 {
margin-bottom:
20px;
}
.card-container {
display: flex;
justify-content: space-
around; margin-bottom:
20px;
transition: opacity 0.5s ease-in-out;
}
.fade-out {
opacity: 0;
}
.output-container {
margin-bottom: 20px; /* Adjust margin if necessary
*/ background-color: #f8f9fa;
padding: 10px;
border-radius:
5px;
color: black; /* Output text color set to black */
}
.chat-history {
max-height: 300px;
overflow-y: auto;
margin-bottom: 20px;
text-align: left;
}
.chat-message {
background-color:
#e9ecef; border-radius:
5px; padding: 10px;
margin-bottom: 10px;
color: black; /* Output text color set to black */
clear: both;
}
.chat-message.user {
background-color: gray; /* Light green for user messages */
34 | P a g e
float: right; /* Float user messages to the right */
text-align: right; /* Align text to the right */
}
35 | P a g e
.chat-message.bot {
background-color: white; /* Light red for bot messages */
float: left; /* Float bot messages to the left */
text-align: left; /* Align text to the left */
}
.toggle-button {
position: absolute;
top: 20px;
left: 20px;
z-index: 1000;
background-color: #333;
color: white;
border: none;
padding: 10px;
border-radius:
5px; cursor:
pointer;
}
</style>
</head>
<body>
<button class="toggle-button" onclick="toggleSidebar()">Past Chats</button>
<div class="sidebar" id="sidebar">
<h2>Past Chats</h2>
<ul>
{% for chat in past_chats %}
<li>
<button class="btn btn-light">{{ chat }}</button>
</li>
{% endfor %}
</ul>
<form method="post">
{% csrf_token %}
<button type="submit" name="new_chat" class="btn btn-primary">New Chat</button>
</form>
</div>
<div class="input-container">
36 | P a g e
<h1>Enter your text</h1>
37 | P a g e
<div class="chat-history">
{% for message in chat_history %}
<div class="chat-message user">
<strong>You:</strong> {{ message.input }}
</div>
<div class="chat-message bot">
<strong>Bot:</strong> {{ message.output }}
</div>
{% endfor %}
</div>
<form method="post">
{% csrf_token %}
<div class="input-group">
<input type="text" name="user_input" class="form-control" placeholder="Type something...">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
</div>
<script>
function toggleSidebar() {
const sidebar = document.getElementById('sidebar');
sidebar.classList.toggle('open');
}
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Output:
38 | P a g e
Views.py:
# Initialize Ollama
ol = Ollama(base_url="http://localhost:11434", model='llama2')
# accept input
def input_view(request):
if 'chat_history' not in request.session:
request.session['chat_history'] = []
if 'past_chats' not in request.session:
request.session['past_chats'] = []
if request.method == 'POST':
if 'new_chat' in request.POST:
request.session['chat_history'] = []
else:
user_input = request.POST.get('user_input')
#Generative Output
ollama_response = ol.invoke(user_input + " create a small output for any query and must have only
health related query.")
ollama_output = ollama_response['text']
output = ollama_output
request.session['chat_history'].append({'input': user_input, 'output': output})
request.session.modified = True
context = {
'chat_history': request.session.get('chat_history'),
'past_chats': request.session.get('past_chats'),
}
return render(request, 'home/input.html', context)
# index
39 | P a g e
def index(request):
return render(request, 'home/index.html')
# about
def about(request):
return render(request, 'home/about.html')
# contact
def contact(request):
if request.method == 'POST':
form = ContactForm(request.POST)
if form.is_valid():
form.save()
return redirect('contact')
else:
form = ContactForm()
40 | P a g e
Chapter 9: Short Description of the Project.
"Heal Me Geni" is a comprehensive web-based application focused on providing health education through an
AI language model (LLM). Built using the Django framework, the application offers an interactive platform
where users can submit health-related questions and receive detailed, informative responses. The aim is to
enhance user understanding and awareness of various health topics by offering accurate and relevant
information.
Key Features:
1. Interactive Query System: Users can ask questions on a wide range of health topics, and the AI
model provides clear and concise answers.
2. Related Query Suggestions: The application suggests related questions based on the user's
initial query, encouraging deeper exploration of health topics.
3. User-Friendly Interface: The application employs a clean and intuitive design, utilizing Bootstrap 5
for responsiveness and modern aesthetics.
4. Dynamic Content Rendering: HTML templates dynamically populated with data ensure a
seamless and personalized user experience.
5. Data Storage: A robust SQLite database stores user interactions and health information, ensuring
data persistence and integrity.
41 | P a g e
Bibliography
Website Visited:
1. https://getbootstrap.com/
2. https://www.w3schools.com
3. https://www.djangoproject.com/
4. https://chatgpt.com/
Reference Books:
1. Think Python
2. Fluent Python
3. Python Cookbook
42 | P a g e