Skip to content

Instantly share code, notes, and snippets.

View ashhadulislam's full-sized avatar

Ashhad ashhadulislam

View GitHub Profile

Hello you are my guidance counsellor.

agent_1: Hello Chad! It's a privilege to be your guidance counselor. I'm here to support and listen, so feel free to share whatever's on your mind. What would you like to talk about today?

I am just passing the 12th class. I like writing and I like Mathematics. but I do not like physics or Chemistry. Can you give me some advice about which direction I should go

agent_1: It's fantastic that you have clear interests, Chad! Writing and mathematics can go together quite uniquely. Have you considered fields like technical writing, finance, or even data science? They combine your mathematical aptitude with your love for writing. It ultimately depends on what aspect of these subjects you love most. Let me know, and we can explore together!

But I need to get a college degree. What kind of degree should I look for?

@ashhadulislam
ashhadulislam / streamChat.py
Created January 10, 2024 17:50
Streamlit chatbot connected to MemGPT (OpenAI Back end)
import streamlit as st
import requests
base_url = "http://localhost:8283/"
headers = {"accept": "application/json"}
st.title("MemGPT Connected Bot")
# check if memgpt server and agents are available
agent_name="agent_1"
Ashhad is working on the project Machine Learning: Scamming Website detection
Project Details Document
Machine Learning: Scamming Website detection
1. Basic details
Student name: Ismail Khuda Bukhsh
Draft project title: Machine Learning: Scamming Website detection
Client organisation: Some projects are done for a client who provides requirements. It may be that you do not have a client for your project, in which case client information and client contact name can be left blank.
Client contact name:
2. Degree suitability
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.document_loaders import PyPDFLoader, DirectoryLoader
from langchain.embeddings import HuggingFaceEmbeddings
from langchain.vectorstores import FAISS
DATA_PATH="data/"
DB_FAISS_PATH = "vectorstores/db_faiss/"
def create_vector_db():
loader=DirectoryLoader(DATA_PATH,glob="*.pdf",loader_cls=PyPDFLoader)
from llama_index import SimpleDirectoryReader
from llama_index import GPTListIndex
from llama_index import GPTVectorStoreIndex
from llama_index import LLMPredictor, PromptHelper
from llama_index import ServiceContext, load_graph_from_storage
from llama_index import StorageContext, load_index_from_storage
from langchain import OpenAI
import gradio as gr
import sys
def predict(model, image_url):
'''
pass the model and image url to the function
Returns: a list of pox types with decreasing probability
'''
if validators.url(image_url) is True:
response = requests.get(image_url)
picture = Image.open(BytesIO(response.content))
else:
picture = Image.open(image_url)
def load_model():
'''
load a model
by default it is resnet 18 for now
'''
model = models.resnet18(pretrained=True)
num_ftrs = model.fc.in_features
model.fc = nn.Linear(num_ftrs, len(classes))
model.to(device)
import torch
import torchvision
from torchvision import datasets, models, transforms
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.optim import lr_scheduler
import torch.backends.cudnn as cudnn
import numpy as np
PATH = './squeezenet1_0.pth'
# setup
model_ft = models.squeezenet1_0(pretrained=True,)
model_ft.classifier[1] = nn.Conv2d(512, len(classes), kernel_size=(1,1), stride=(1,1))
model_ft = model_ft.to(device)
criterion = nn.CrossEntropyLoss()
optimizer_ft = optim.SGD(model_ft.parameters(), lr=0.001, momentum=0.9)
exp_lr_scheduler = lr_scheduler.StepLR(optimizer_ft, step_size=7, gamma=0.1)