Skip to content

Commit f1ff05d

Browse files
committed
bot
1 parent 2ead401 commit f1ff05d

9 files changed

+572
-2
lines changed

README.md

+72-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,72 @@
1-
# bot
2-
MpaMpe Bot Built by Palm AI
1+
![Binaryhood](Logo/BinaryhoodLogo.png)
2+
3+
# ChatBot
4+
5+
## Installation & Setup
6+
7+
[Install Python] https://www.dataquest.io/blog/installing-python-on-mac/
8+
9+
[Install pip] https://phoenixnap.com/kb/install-pip-mac
10+
11+
If you have Python & pip installed then check their version in the terminal or command line tools
12+
13+
```
14+
python3 --version
15+
```
16+
17+
```
18+
pip --version
19+
```
20+
21+
## Installing Flask
22+
23+
In your terminal run the requirements.txt file using this pip
24+
25+
```
26+
pip install -r requirements.txt
27+
```
28+
29+
30+
## Running ChatBot Application in Terminal
31+
32+
```
33+
cd into your directory
34+
```
35+
36+
```
37+
python app.py
38+
```
39+
40+
41+
42+
## What you will create
43+
44+
In this tutorial, I will guide you through the process of building a chatbot that can carry out conversations with users using natural language processing.
45+
46+
To start, we will be using Microsoft DialoGPT, a pre-trained language model that can generate human-like responses to given prompts. We will be integrating DialoGPT with Flask, a popular Python web framework, to create a web application that can communicate with users via a chat interface.
47+
48+
For the frontend of our application, we will be using HTML, CSS, and JavaScript to create a visually appealing and interactive chat interface. Additionally, we will be using jQuery to handle the HTTP requests that are made to the backend server.
49+
50+
Throughout the tutorial, I will provide step-by-step instructions on how to set up your development environment, install the necessary dependencies, and create the required files and code for the application. I will also explain how to train and fine-tune the DialoGPT model to improve the accuracy of its responses.
51+
52+
By the end of this tutorial, you will have a fully functional chatbot that can engage in conversations with users, and you will have gained valuable experience in using Microsoft DialoGPT, Flask, and web development technologies such as HTML, CSS, and JavaScript.
53+
54+
# ChatBot Link
55+
The Chatbot is constructed using the Microsoft/DialoGPT-medium model.
56+
57+
```
58+
https://huggingface.co/microsoft/DialoGPT-medium
59+
```
60+
61+
# User-Html
62+
63+
```
64+
var userHtml = '<div class="d-flex justify-content-end mb-4"><div class="msg_cotainer_send">' + user_input + '<span class="msg_time_send">'+ time +
65+
'</span></div><div class="img_cont_msg"><img src="https://i.ibb.co/d5b84Xw/Untitled-design.png" class="rounded-circle user_img_msg"></div></div>';
66+
```
67+
68+
# Bot-HTML
69+
70+
```
71+
var botHtml = '<div class="d-flex justify-content-start mb-4"><div class="img_cont_msg"><img src="https://i.ibb.co/fSNP7Rz/icons8-chatgpt-512.png" class="rounded-circle user_img_msg"></div><div class="msg_cotainer">' + bot_response + '<span class="msg_time">' + time + '</span></div></div>';
72+
```

app.py

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from flask import Flask, render_template, request, jsonify
2+
import pprint
3+
import mpampe
4+
import google.generativeai as palm
5+
6+
palm.configure(api_key='AIzaSyDslGELzeDfdc3DLufleR1y2Reie8RSGfk')
7+
model = palm.get_model('models/chat-bison-001')
8+
9+
app = Flask(__name__, template_folder='templates', static_folder='static')
10+
11+
@app.route("/")
12+
def index():
13+
return render_template('chat.html')
14+
15+
@app.route("/get", methods=["POST"])
16+
def chat():
17+
if request.method == "POST":
18+
msg = request.form["msg"]
19+
response = get_Chat_response(msg)
20+
return response
21+
22+
def get_Chat_response(prompt):
23+
response = palm.chat(
24+
context=mpampe.MpaMpe,
25+
model=model,
26+
messages=[prompt]
27+
)
28+
# Extract Response Here
29+
bot_response = response.messages[-1]['content']
30+
31+
# You can also print the entire response for debugging purposes
32+
print(response)
33+
34+
return bot_response
35+
36+
if __name__ == '__main__':
37+
app.run()

mpampe.py

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
MpaMpe = """
2+
MpaMpe Crowdfunding Platform:
3+
MpaMpe is a Ugandan web-based crowdfunding platform that facilitates the raising of funds for a wide range of purposes, including education, healthcare, community development, and innovative projects. The platform operates on the core principle of "Give Me I Give Out" in Luganda, a local language in Uganda, signifying the spirit of communal support and collective empowerment.
4+
MpaMpe is a new startup (A Ugandan version of GoFund Me). It was founded by Makerere University Students in 2022.
5+
6+
Key Features and Benefits:
7+
Financial Inclusion: MpaMpe addresses financial inclusion challenges by allowing individuals and organizations, including students, to create crowdfunding campaigns to fund their needs and initiatives.
8+
9+
Transparent and Accountable: The platform provides transparency by showcasing campaign details, progress, and funds collected. Donors can track how their contributions are used.
10+
11+
Diverse Use Cases: MpaMpe supports a broad spectrum of causes, including tuition fees, medical bills, business startups, community projects, and research endeavors.
12+
13+
Community Building: It fosters a sense of community and solidarity, enabling individuals to rally support from friends, family, colleagues, and well-wishers.
14+
15+
Impactful Results: MpaMpe has successfully funded numerous campaigns, making a positive impact on education, healthcare, and various community development projects.
16+
17+
Recognition: The platform has received recognition through awards and acknowledgments, including winning hackathons and being featured as a top innovation in the Google Developer Solution Challenge.
18+
19+
Steps to create a campaign:
20+
Research and Planning:
21+
22+
Understand the purpose of your campaign.
23+
Identify your target audience and potential supporters.
24+
Determine the specific goal or financial target you need to achieve.
25+
Create an Account:
26+
27+
Sign up or log in to your MpaMpe account.
28+
Start a Campaign:
29+
30+
Look for a "Create Campaign" or similar button.
31+
Provide information about your campaign, such as the title, description, and your funding goal.
32+
Set a Funding Goal:
33+
34+
Determine how much money you need for your project or cause.
35+
Tell Your Story:
36+
37+
Explain why you're raising funds and how the money will be used.
38+
Use compelling images and videos to illustrate your story.
39+
Choose a Deadline:
40+
41+
Set a time frame for your campaign.
42+
Select a Category:
43+
44+
Choose the appropriate category for your campaign (e.g., education, healthcare, community, etc.).
45+
Add Perks or Rewards (if applicable):
46+
47+
Some crowdfunding campaigns offer rewards or perks to backers in exchange for their support.
48+
Promote Your Campaign:
49+
50+
Share your campaign through social media, email, and other communication channels.
51+
Encourage your network to share the campaign as well.
52+
Engage with Supporters:
53+
54+
Respond to comments and questions from backers.
55+
Keep your supporters updated on your progress.
56+
Monitor Your Campaign:
57+
58+
Track how much money you've raised.
59+
Make adjustments to your promotion strategy if necessary.
60+
Fulfill Promises:
61+
62+
If you've promised rewards or perks, make sure to deliver them as planned.
63+
Express Gratitude:
64+
65+
Thank your supporters for their contributions.
66+
67+
More Help Email: [email protected]
68+
In summary, MpaMpe is more than just a crowdfunding platform; it's a catalyst for change, enabling individuals and organizations to transform their aspirations into reality by harnessing the power of collective support and financial inclusion.
69+
70+
"""

requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
flask
2+
vertexai
3+
google-generativeai

static/mpampe.ico

116 KB
Binary file not shown.

static/mpampelogo.png

36.6 KB
Loading

0 commit comments

Comments
 (0)