-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathutil.py
144 lines (96 loc) Β· 5.68 KB
/
util.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import streamlit as st
import pandas as pd
import numpy as np
import requests
from st_social_media_links import SocialMediaIcons
from LogoYolo.inference import predict
from PIL import Image
from NewsQALLM.chatbot import ChatBot
from icons import glowingSocial,glowingYolo,glowingLLM
def Social(sidebarPos = False,heading = None):
if heading != None:
st.title(f":rainbow[{heading}]")
social_media_links = [
"https://www.linkedin.com/in/sushovan-saha-29a00a113",
"https://github.com/ambideXtrous9",
"https://medium.com/@sushovansaha95"]
social_media_icons = SocialMediaIcons(social_media_links)
social_media_icons.render(sidebar=sidebarPos, justify_content="center")
def HomePage():
st.title(":blue[My Portfolio] π€")
gif_path = 'thor.gif'
col1, col2 = st.columns([1, 2])
with col1:
st.image(gif_path)
# Display "About Me" text in the right column
with col2:
st.subheader("π± About Me")
st.write("""
π Hi there! I'm **Sushovan Saha**, a Machine Learning (ML) enthusiast specializing in **Natural Language Processing (NLP)** and **Computer Vision (CV)**.
I did my M.Tech in Data Science from **IIT Guwahati**. I am also a **Kaggle Notebook Expert**.
π I'm passionate about exploring the possibilities of ML to solve real-world problems and improve people's lives.
I love working on challenging projects that require me to stretch my abilities and learn new things.
π In my free time, I like to contribute in **Kaggle**, Write ML blogs in **Medium**, read ML related blogs and updates.
I'm always looking for ways to stay up-to-date with the latest developments in the field.
""")
glowingSocial()
def GitHubStats():
st.title(":rainbow[GitHub Stats]")
username = "ambideXtrous9" # Replace with your GitHub username
response = requests.get(f"https://api.github.com/users/{username}")
if response.status_code == 200:
user_data = response.json()
st.write(f"**Username:** {user_data['login']}")
st.write(f"**Name:** {user_data.get('name', 'N/A')}")
st.write(f"**Public Repos:** {user_data['public_repos']}")
st.write(f"**Followers:** {user_data['followers']}")
st.write(f"**Following:** {user_data['following']}")
st.write(f"**Profile URL:** {user_data['html_url']}")
else:
st.error("Failed to fetch GitHub stats. Please check the username or try again later.")
def YoloforLogo():
st.write("""
### π **YOLOv8.1: The Latest in Object Detection**
- π **YOLOv8.1 is out!**: The newest update in the YOLO series, maintaining its position as the state-of-the-art model for:
- π― **Object Detection**
- π **Instance Segmentation**
- π·οΈ **Classification**
### β οΈ **Main Challenge: Custom Dataset Preparation**
- π **Dataset Selection**: Using **Flickr27** as our image dataset.
- πΈ **Flickr27 Overview**: Contains 27 different brand logos, perfect for training YOLO on custom data.
- πΌ **Custom Dataset Prep**: The most crucial step in training YOLO models.
- π οΈ **Get Ready to Train**: With YOLOv8.1 and Flickr27, you'll be well-equipped to handle custom object detection tasks!
""")
uploaded_file = st.file_uploader("Upload an Image containing Brand Logo", type=["jpg", "jpeg", "png"])
if uploaded_file is not None:
uploaded_image = Image.open(uploaded_file)
# Perform prediction
prediction_image = predict(uploaded_image)
# Create two columns for side-by-side images
col1, col2 = st.columns(2)
with col1:
st.image(uploaded_file, caption="Uploaded Image", width = 200,use_column_width='auto')
with col2:
st.image(prediction_image, caption="Predicted Image", width=200,use_column_width='auto')
glowingYolo()
def NewsQA():
st.write("""
### π§ **Step 1: Initial QA with Gemma 2b (No Fine-Tuning)**
- π **Load Gemma 2b instruct model**: Start with the pre-trained model.
- π **Create suitable prompts**: Develop prompts tailored for your QA task.
- β
**Run QA**: Test the model's performance on Indian News QA without any fine-tuning.
### π― **Step 2: Fine-Tune Gemma with Indian News Dataset**
- π **Gather Indian News Dataset**: Collect and prepare the relevant dataset.
- π§ **Fine-tune Gemma**: Adjust the model using the dataset to enhance its performance for QA tasks.
- π **Evaluate Results**: Compare the model's performance before and after fine-tuning.
### π **Step 3: Use RAG for Context Fetching**
- π οΈ **Integrate RAG**: Utilize RAG for context retrieval to improve QA accuracy.
- **Steps Involved:**
- βοΈ **Text Chunking**: Split the text data into smaller, token-based chunks.
- 𧬠**Generate Embeddings**: Use `SentenceTransformer` to create embeddings for each chunk.
- ποΈ **Store in ChromaDB**: Save the embeddings in ChromaDB for efficient retrieval.
- π **Context Fetching**: Retrieve the relevant context from ChromaDB for a given query.
- π― **Final QA**: Run the QA with the fine-tuned Gemma model and the retrieved context.
""")
glowingLLM()
ChatBot()