Skip to content
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

7376222IT231/RAMKUMAR K #14

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0cd550b
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 28, 2024
33ce3dc
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 28, 2024
4fab60d
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 28, 2024
af48b06
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 28, 2024
34faa2b
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 28, 2024
cb1060a
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 28, 2024
e1a72d5
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 28, 2024
668dbb0
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 28, 2024
e8555f2
Add files via upload
ramkumar-bitsathy Sep 28, 2024
f064684
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 29, 2024
a0ef6ea
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 29, 2024
02dc410
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 29, 2024
0f6221b
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 29, 2024
57df5c2
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 29, 2024
4b3fe7a
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 29, 2024
9dd2359
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 29, 2024
ddca2dd
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 29, 2024
1973827
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 29, 2024
713ba5f
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 29, 2024
25265ea
Update Day-1-Assignments.md
ramkumar-bitsathy Sep 29, 2024
9cddb71
Update Day-2-Assignments.md
ramkumar-bitsathy Sep 29, 2024
2d50567
Update Day-2-Assignments.md
ramkumar-bitsathy Sep 29, 2024
c14c4b8
Update Day-2-Assignments.md
ramkumar-bitsathy Sep 29, 2024
83d019a
Update Day-2-Assignments.md
ramkumar-bitsathy Sep 29, 2024
eab8095
Delete Code/dockerintelligence directory
ramkumar-bitsathy Sep 29, 2024
f555756
Add files via upload
ramkumar-bitsathy Sep 29, 2024
caa99e8
Add files via upload
ramkumar-bitsathy Sep 29, 2024
40d0806
Update Day-2-Assignments.md
ramkumar-bitsathy Sep 29, 2024
05b910f
Add files via upload
ramkumar-bitsathy Sep 29, 2024
d4a1933
Update README.md
ramkumar-bitsathy Sep 29, 2024
b9d1484
Update Day-2-Assignments.md
ramkumar-bitsathy Sep 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Code/01_python_hello_world/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM python:3.8-slim-buster

COPY helloworld.py /

CMD ["python","./helloworld.py"]
8 changes: 8 additions & 0 deletions Code/01_python_hello_world/helloworld.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def main():
print("Hello world")
print("Ramkumar K")
print("7376222IT231")
print("Department of Information Techology.")

if __name__ == "__main__":
main()
13 changes: 13 additions & 0 deletions Code/02_flask_hello_world/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:3.9-slim

WORKDIR /app

COPY . /app

RUN pip install --no-cache-dir Flask

EXPOSE 5000

ENV FLASK_APP=app.py

CMD ["flask","run","--host=0.0.0.0"]
10 changes: 10 additions & 0 deletions Code/02_flask_hello_world/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from flask import Flask

app = Flask(__name__)

@app.route('/')
def hello_world():
return "Hello, world " + "I'm Ramkumar (7376222IT231) " + "from Department of Information Technology."

if __name__ == "__main__":
app.run(debug=True)
14 changes: 14 additions & 0 deletions Code/03_docker_compose/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3'
services:
ramkumar:
image: "kramkumar27/flask-helloworld"
container_name: ramkumar_container
restart: always
ports:
- "7777:5000"
pawan:
image: "pawang08/app"
container_name: pawan_container
restart: always
ports:
- "8888:5000"
49 changes: 49 additions & 0 deletions Code/04_ml_example/01_email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Import necessary libraries
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import make_pipeline
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score

# Step 1: Sample email data (you should have more data for better results)
emails = [
"Congratulations! You've won a $1000 gift card, click here to claim now",
"Dear customer, your invoice for the month of August is attached. Please pay it by the end of the month.",
"Exclusive offer! Get 50% off on your next purchase, hurry up before the offer ends!",
"Your bank statement is available for viewing online. Please log in to your account to review.",
"Act now! You have a chance to win a free trip to Paris. Click the link to participate.",
"Your meeting has been scheduled for 2 PM tomorrow. Please confirm your attendance.",
"Urgent! Your account has been suspended due to suspicious activity. Verify your account to restore access.",
"Reminder: The project report is due tomorrow. Please submit it by the end of the day.",
"Your order has been shipped and is expected to arrive within 3 business days.",
"You have a new voicemail from your phone service provider."
]
labels = [1, 0, 1, 0, 1, 0, 1, 0, 0, 0] # 1: Spam, 0: Not Spam

# Step 2: Vectorization and classification
# Create a pipeline with a CountVectorizer and a Naive Bayes model
model = make_pipeline(CountVectorizer(lowercase=True, stop_words='english'), MultinomialNB())

# Step 3: Train the model
model.fit(emails, labels)

# Step 4: Test with new emails
new_emails = [
"Claim your free iPhone now by clicking this link!",
"Your Amazon package has been delivered, thank you for your purchase.",
"Win a free car! Enter our giveaway contest.",
"Your work report is due by the end of the week. Please submit it on time."
]

# Predict the labels for new emails
predictions = model.predict(new_emails)

# Step 5: Display results
for email, label in zip(new_emails, predictions):
print(f"Email: '{email}' is classified as: {'Spam' if label == 1 else 'Not Spam'}")

# Optional: Evaluate the accuracy with a train/test split
X_train, X_test, y_train, y_test = train_test_split(emails, labels, test_size=0.2, random_state=42)
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print(f"Accuracy: {accuracy_score(y_test, y_pred) * 100:.2f}%")
7 changes: 7 additions & 0 deletions Code/04_ml_example/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM python:3.8-slim-buster

COPY 01_email.py /

RUN pip install --no-cache-dir scikit-learn

CMD [ "python", "./01_email.py" ]
38 changes: 38 additions & 0 deletions Code/05_ml_example/01_movie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Import necessary libraries
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import make_pipeline

# Step 1: Data - Movie reviews and labels (0: Negative, 1: Positive)
reviews = [
"This movie was fantastic, I loved it!",
"The plot was boring and predictable",
"Amazing performance by the cast",
"I wasted two hours of my life",
"Brilliant direction and storytelling",
"The movie was a disaster",
"What a great film!",
"It was an awful experience",
"The cinematography was beautiful",
"Terrible acting and poor script"
]
labels = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0] # 1: Positive, 0: Negative

# Step 2: Create a pipeline to combine vectorization and model
# Vectorizer with stop words removal and other pre-processing features
vectorizer = CountVectorizer(lowercase=True, stop_words='english')
classifier = MultinomialNB()

# Pipeline to process and classify
model = make_pipeline(vectorizer, classifier)

# Step 3: Train the model
model.fit(reviews, labels)

# Step 4: Test the model with new reviews
new_reviews = ["The movie was a masterpiece", "Worst film I've ever seen", "The plot was very engaging", "Terrible acting"]
predicted = model.predict(new_reviews)

# Step 5: Output the predictions
for review, label in zip(new_reviews, predicted):
print(f"Review: '{review}' is classified as: {'Positive' if label == 1 else 'Negative'}")
7 changes: 7 additions & 0 deletions Code/05_ml_example/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM python:3.8-slim-buster

COPY 01_movie.py /

RUN pip install --no-cache-dir scikit-learn

CMD [ "python", "./01_movie.py" ]
12 changes: 12 additions & 0 deletions Code/05_ml_example/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3'
services:
email:
image: "kramkumar27/email"
container_name: email_container
restart: always

movie:
image: "kramkumar27/movie"
container_name: movie_container
restart: always

Loading