From ee62f23f98bb8ecf7cb3da1cf09bdfff91fdd1d1 Mon Sep 17 00:00:00 2001 From: Mikeyzgoat Date: Wed, 5 Jun 2024 13:32:24 +0530 Subject: [PATCH 1/3] updated git ignore file --- .gitignore | 71 +++++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/.gitignore b/.gitignore index 05647d5..a7e5673 100644 --- a/.gitignore +++ b/.gitignore @@ -1,35 +1,36 @@ -# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files - -# dependencies -node_modules/ - -# Expo -.expo/ -dist/ -web-build/ - -# Native -*.orig.* -*.jks -*.p8 -*.p12 -*.key -*.mobileprovision - -# Metro -.metro-health-check* - -# debug -npm-debug.* -yarn-debug.* -yarn-error.* - -# macOS -.DS_Store -*.pem - -# local env files -.env*.local - -# typescript -*.tsbuildinfo +# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files + +# dependencies +node_modules/ +.env +./back-end/data.json +# Expo +.expo/ +dist/ +web-build/ + +# Native +*.orig.* +*.jks +*.p8 +*.p12 +*.key +*.mobileprovision + +# Metro +.metro-health-check* + +# debug +npm-debug.* +yarn-debug.* +yarn-error.* + +# macOS +.DS_Store +*.pem + +# local env files +.env*.local + +# typescript +*.tsbuildinfo From 165c7bd65bf8aac47246c28ab139a4451136c9ae Mon Sep 17 00:00:00 2001 From: Mikeyzgoat Date: Wed, 5 Jun 2024 13:32:52 +0530 Subject: [PATCH 2/3] updated git ignore updated git ignore updated git ignore added back end file --- .gitignore | 2 +- back-end/__pycache__/main.cpython-310.pyc | Bin 0 -> 5517 bytes back-end/__pycache__/testnew.cpython-310.pyc | Bin 0 -> 802 bytes back-end/aristotle_modelbuild.py | 7 + back-end/data.json | 328 +++++++++++++++++++ back-end/main.py | 143 ++++++++ 6 files changed, 479 insertions(+), 1 deletion(-) create mode 100644 back-end/__pycache__/main.cpython-310.pyc create mode 100644 back-end/__pycache__/testnew.cpython-310.pyc create mode 100644 back-end/aristotle_modelbuild.py create mode 100644 back-end/data.json create mode 100644 back-end/main.py diff --git a/.gitignore b/.gitignore index a7e5673..a6bb5c9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ # dependencies node_modules/ .env -./back-end/data.json +./data.json # Expo .expo/ dist/ diff --git a/back-end/__pycache__/main.cpython-310.pyc b/back-end/__pycache__/main.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f2b0dc150d699ffa81f54d9cccb986df2838c9a7 GIT binary patch literal 5517 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 a%ov4k7x|v+y2$ioLtYzxf3fW9!5K literal 0 HcmV?d00001 diff --git a/back-end/aristotle_modelbuild.py b/back-end/aristotle_modelbuild.py new file mode 100644 index 0000000..86e5b01 --- /dev/null +++ b/back-end/aristotle_modelbuild.py @@ -0,0 +1,7 @@ +import ollama + +modelfile=""" +FROM llava:7b +SYSTEM you are aristotle, you have the power to answer any question that is put forward to you, in response, answer every question that is asked to you.Do not greet a seeker. +""" +ollama.create(model='aristotle',modelfile=modelfile) \ No newline at end of file diff --git a/back-end/data.json b/back-end/data.json new file mode 100644 index 0000000..9daeecf --- /dev/null +++ b/back-end/data.json @@ -0,0 +1,328 @@ +{ + "users": [ + "Teja", + "Yoma", + "Tejavu", + "aditya", + "Swaroop", + "Yogi", + "Shreyas", + "Shasha", + "Tejasr", + "Shas", + "ash", + "Vija", + "Sks", + "Priya", + "Aditya14", + "Arpitha", + "Nandan", + "Anjan", + "John", + "Sjs", + "Skss", + "J", + "Skssa", + "Yogith", + "Yash" + ], + "chathistory": [ + { + "Teja": [ + { + "role": "user", + "content": "Describe racket " + }, + { + "role": "assistant", + "content": "Ah, the racket. A marvel of engineering and simplicity, the humble racket. A flat, rectangular piece of wood or metal, crafted to perfection, it serves a simple purpose yet with unmatched effectiveness.\n\nIts design is remarkably effective for both offensive and defensive play. A racket is designed to generate power and control, allowing the user to hit the ball with sufficient force to send it soaring or to block an opponent's shots.\n\nThe grip is crucial for control, with the racket head resting comfortably in the palm. The handle, often crafted from wood or synthetic materials, allows for comfortable and secure grip.\n\nThe materials used for rackets vary, with wood being the most traditional and preferred choice. Modern rackets often incorporate metal frames for enhanced durability and performance.\n\nThe sound of the racket is one of its most distinctive features, a crisp and satisfying \"pop\" as the shuttlecock hits the ball. This sound, while seemingly insignificant, is an essential element of the game, adding to the overall experience.\n\nThe racket is a versatile tool that can be used in various ways in the world of sports. From tennis and badminton to badminton and squash, the racket is the quintessential weapon for athletes seeking to dominate their chosen sport.\n\nSo, what else can I tell you about the humble racket? What questions can I answer about this fascinating object?" + }, + { + "role": "user", + "content": "Describe Taj Mahal in 5 lines " + }, + { + "role": "assistant", + "content": "Taj Mahal is a white marble mausoleum built by Mughal emperor Shah Jahan in memory of his beloved wife, Mumtaz Mahal. It is situated in the heart of the city of Agra, India. The Taj Mahal is a marvel of architecture, with intricate design and stunning construction. It is a testament to the artistry and craftsmanship of the Mughal period." + } + ] + }, + { + "Yoma": [] + }, + { + "Tejavu": [] + }, + { + "aditya": [ + { + "role": "user", + "content": "describe bangalore in 1-2 sentences" + }, + { + "role": "assistant", + "content": "The bustling city of Bangalore, nestled amidst rolling hills and the Western Ghats, pulsates with life and energy. It boasts a rich cultural heritage, vibrant arts, and a thriving tech scene that has made it a global hub of innovation and economic power." + }, + { + "role": "user", + "content": "about which city did i ask you about" + }, + { + "role": "assistant", + "content": "I have learned that you are asking about the city of Bangalore in India." + } + ] + }, + { + "Swaroop": [] + }, + { + "Yogi": [] + }, + { + "Shreyas": [] + }, + { + "Shasha": [] + }, + { + "Tejasr": [] + }, + { + "Shas": [] + }, + { + "ash": [] + }, + { + "Vija": [] + }, + { + "Sks": [ + { + "role": "user", + "content": "Describe Taj Mahal in 5 lines " + }, + { + "role": "assistant", + "content": "The Taj Mahal, a monument of love and beauty, stands as a testament to the enduring power of human affection. Its white marble fa\u00e7ade, adorned with intricate carvings and delicate filigree, casts a spellbinding glow on the surrounding landscape. The intricate details and soaring arches evoke a sense of awe and wonder, while the sheer scale and grandeur of the structure leave visitors in awe." + }, + { + "role": "user", + "content": "Describe Taj Mahal in 5 " + }, + { + "role": "assistant", + "content": "The Taj Mahal is a white marble mausoleum located in the heart of the city of Agra, India. It is a symbol of love and devotion between the Mughal emperor Shah Jahan and his wife, Mumtaz Mahal. The Taj Mahal was built in the memory of Mumtaz Mahal after her death in 1631. It is a masterpiece of Mughal architecture, with intricate carvings and a symmetrical design. The white marble used in the construction of the Taj Mahal is of the finest quality, and the intricate details and delicate patterns are a testament to the skill of the artisans who built it." + } + ] + }, + { + "Priya": [ + { + "role": "user", + "content": "Describe Taj Mahal in 5 lines " + }, + { + "role": "assistant", + "content": "The Taj Mahal is a white marble mausoleum built by the Mughal emperor Shah Jahan in memory of his wife, Mumtaz Mahal. It is located in the city of Agra, India. The Taj Mahal is a UNESCO World Heritage Site and is considered one of the most beautiful buildings in the world. Its white marble facade is adorned with intricate designs and motifs, and its interior is decorated with precious stones and gold." + }, + { + "role": "user", + "content": "Describe bat and ball" + }, + { + "role": "assistant", + "content": "I cannot describe a bat and ball, as they are inanimate objects." + } + ] + }, + { + "Aditya14": [] + }, + { + "Arpitha": [] + }, + { + "Nandan": [] + }, + { + "Anjan": [] + }, + { + "John": [] + }, + { + "Sjs": [] + }, + { + "Skss": [] + }, + { + "J": [] + }, + { + "Skssa": [] + }, + { + "Yogith": [] + }, + { + "Yash": [] + } + ], + "credentials": [ + { + "Teja": "$2b$12$oCHHCtYhQX6IU6XcXjOesOpF5Ov5y2wtffd3Cd4fdflzJMEN9ciWm" + }, + { + "Yoma": "$2b$12$oCHHCtYhQX6IU6XcXjOesOzaRKuUROBV2HPp8n64bbMSZUojAs8CS" + }, + { + "Tejavu": "$2b$12$oCHHCtYhQX6IU6XcXjOesOpF5Ov5y2wtffd3Cd4fdflzJMEN9ciWm" + }, + { + "aditya": "$2b$12$oCHHCtYhQX6IU6XcXjOesOe5PSSsHUqB/g45l6lhMKPQy5Fbntk.m" + }, + { + "Swaroop": "$2b$12$oCHHCtYhQX6IU6XcXjOesOW94MZz6z0u/Hif7j/SX.q2kEUa58KY." + }, + { + "Yogi": "$2b$12$oCHHCtYhQX6IU6XcXjOesOzaRKuUROBV2HPp8n64bbMSZUojAs8CS" + }, + { + "Shreyas": "$2b$12$oCHHCtYhQX6IU6XcXjOesOqopIKLZ/aVl23DyNkNGhvCfbV/BmkZW" + }, + { + "Shasha": "$2b$12$oCHHCtYhQX6IU6XcXjOesOqopIKLZ/aVl23DyNkNGhvCfbV/BmkZW" + }, + { + "Tejasr": "$2b$12$oCHHCtYhQX6IU6XcXjOesOpF5Ov5y2wtffd3Cd4fdflzJMEN9ciWm" + }, + { + "Shas": "$2b$12$oCHHCtYhQX6IU6XcXjOesOqopIKLZ/aVl23DyNkNGhvCfbV/BmkZW" + }, + { + "ash": "$2b$12$oCHHCtYhQX6IU6XcXjOesONFsstA.7aQg4.pqoPGfrc6KErhxQnSK" + }, + { + "Vija": "$2b$12$oCHHCtYhQX6IU6XcXjOesO1LtVf3JTbae3Hv8WeaOtPXjys6PaXx2" + }, + { + "Sks": "$2b$12$oCHHCtYhQX6IU6XcXjOesOLJN9tTnCncKg8maPOLajUhvUahs2LXm" + }, + { + "Priya": "$2b$12$oCHHCtYhQX6IU6XcXjOesOJqA9JysseMXJWQ2GHPdycJx2rWrD8vu" + }, + { + "Aditya14": "$2b$12$oCHHCtYhQX6IU6XcXjOesOjCCGqMkxud1FGsH.6xySndcoijVZ2p." + }, + { + "Arpitha": "$2b$12$oCHHCtYhQX6IU6XcXjOesOo3ePYecNDy8Pjecoca3offbU.yk5cWW" + }, + { + "Nandan": "$2b$12$oCHHCtYhQX6IU6XcXjOesOwlQm7/5zaH.KviTZW/vITl0U3JllWLi" + }, + { + "Anjan": "$2b$12$oCHHCtYhQX6IU6XcXjOesOsyC7MTVGpiMXeOQv7zhrQxFs9DViVfG" + }, + { + "John": "$2b$12$oCHHCtYhQX6IU6XcXjOesOsyC7MTVGpiMXeOQv7zhrQxFs9DViVfG" + }, + { + "Sjs": "$2b$12$oCHHCtYhQX6IU6XcXjOesOLJN9tTnCncKg8maPOLajUhvUahs2LXm" + }, + { + "Skss": "$2b$12$oCHHCtYhQX6IU6XcXjOesOlKkd3CRiXLvj/8CUbmWgmLn7HWlsXI." + }, + { + "J": "$2b$12$oCHHCtYhQX6IU6XcXjOesOT61oHdu30B5H/tUc0pTdpSHpqxYG3EK" + }, + { + "Skssa": "$2b$12$oCHHCtYhQX6IU6XcXjOesOHlcZNqcl8KSfZzJaupMuKDJvYZKZLUO" + }, + { + "Yogith": "$2b$12$oCHHCtYhQX6IU6XcXjOesOsyC7MTVGpiMXeOQv7zhrQxFs9DViVfG" + }, + { + "Yash": "$2b$12$oCHHCtYhQX6IU6XcXjOesOPQ9HvpCHqr3VA1lIwrN5lkgXRhEOO9S" + } + ], + "imgIdandcaptions": [ + { + "Teja": [] + }, + { + "Yoma": [] + }, + { + "Tejavu": [] + }, + { + "aditya": [] + }, + { + "Swaroop": [] + }, + { + "Yogi": [] + }, + { + "Shreyas": [] + }, + { + "Shasha": [] + }, + { + "Tejasr": [] + }, + { + "Shas": [] + }, + { + "ash": [] + }, + { + "Vija": [] + }, + { + "Sks": [] + }, + { + "Priya": [] + }, + { + "Aditya14": [] + }, + { + "Arpitha": [] + }, + { + "Nandan": [] + }, + { + "Anjan": [] + }, + { + "John": [] + }, + { + "Sjs": [] + }, + { + "Skss": [] + }, + { + "J": [] + }, + { + "Skssa": [] + }, + { + "Yogith": [] + }, + { + "Yash": [] + } + ] +} \ No newline at end of file diff --git a/back-end/main.py b/back-end/main.py new file mode 100644 index 0000000..26bd99d --- /dev/null +++ b/back-end/main.py @@ -0,0 +1,143 @@ +from fastapi import APIRouter,Depends, UploadFile +from fastapi.responses import Response +from httpx import ResponseNotRead +import ollama +from pydantic import BaseModel +from typing import Optional +import json +from PIL import Image +import io +import aiofiles +import asyncio +import uvicorn +import requests +from hashlib import sha256 +import bcrypt as bc +import os +from dotenv import load_dotenv +import base64 +import ngrok +# ngrok static domain +# ngrok http --domain=osprey-amazing-tightly.ngrok-free.app 80 +# instantiate the LLM LLaVa +load_dotenv() + +class ChatTemplate(BaseModel): + username:str + prompt:str + images:Optional[bytes]=None + +class AuthTemplate(BaseModel): + username:str + password:Optional[str]=None + +class ImageTemplate(BaseModel): + username:str + images:bytes + image_id:str + +class ChatHistoryTemplate(BaseModel): + username:str + chathistory:list + +# encryption and hashing phase +salt = os.getenv("SALT") +# Text to image api key +STABLE_DIFFUSION_KEY = os.getenv("STABLE_DIFFUSION_API_KEY") +IMAGE_CAPTIONING_API_KEY=os.getenv("IMAGE_CAPTIONING_API_KEY") + + +# 3 prompt templates +""" +1 - captions only +2 - objects only +3 - VQA +""" + +# create database access,i.e JSON FILE + +#instantiate api +app= APIRouter() + +@app.post("/userlogin/") +def user_login_validate(request:AuthTemplate): + with open("data.json","r") as f: + dt = json.load(f) + + if request.username in dt["users"]: + y = [i[j] for i in dt["credentials"] for j in i if j ==request.username] + x= bc.checkpw(request.password.encode("utf-8"), y[0].encode("utf-8")) + return {"response":x} + +@app.post("/createnewuser/") +def create_new_user(request:AuthTemplate): + # append data into the database + with open("data.json","r") as f: + dt = json.load(f) + if request.username in dt["users"]: + return {"response":"username already exists"} + else: + with open("data.json","w") as f: + dt["users"]+= [request.username] + dt["chathistory"]+=[{request.username:[]}] + dt["imgIdandcaptions"]+=[{request.username:[]}] + # hashing + hash_string_pass = bc.hashpw(request.password.encode("utf-8"),salt=salt.encode("utf-8")) + hash_string_pass=hash_string_pass.decode('utf-8') + dt["credentials"]+=[{request.username:hash_string_pass}] + json.dump(dt,f,indent=4) + return {"status":200} + +@app.post("/storechathistory") +def store_chat_history(data:ChatHistoryTemplate): + with open("data.json","r") as f: + dt = json.load(f) + messages = [i[j] for i in dt["chathistory"] for j in i if j ==data.username][0] + messages.append(data.chathistory) + with open("data.json","w") as f: + json.dump(dt,f,indent=4) + return {"response":"done"} + + +@app.get("/fetchchathistory/{username}") +def fetch_chat_history(username:str): + with open("data.json","r") as f: + dt = json.load(f) + x = [i[j] for i in dt["chathistory"] for j in i if j ==username] + return x[0] + + +@app.post("/api/generateimagecaption") +def generate_image_caption(req:ImageTemplate): + API_URL = "https://api-inference.huggingface.co/models/Salesforce/blip-image-captioning-large" + headers = {"Authorization": f"Bearer {IMAGE_CAPTIONING_API_KEY}"} + response = requests.post(API_URL,headers=headers,data=req.images) + return response.json() + + +@app.post("/api/visualqa/") +def visualqa(req:ChatTemplate): # handle images and text generation based on previous queries by users + with open("data.json","r") as f: + dt = json.load(f) + messages = [i[j] for i in dt["chathistory"] for j in i if j ==req.username][0] + messages.append({"role":"user","content":req.prompt}) + result = ollama.chat(model="aristotle:latest",messages=messages) + messages.append(result["message"]) + with open("data.json","w") as f: + json.dump(dt,f,indent=4) + return {"response":messages} + +# text to image( in bytes ) +@app.post("/texttoimage/") +def text_to_image(req:ChatTemplate): + API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0" + headers = {"Authorization": f"Bearer {STABLE_DIFFUSION_KEY}"} + response = requests.post(API_URL,headers=headers,json={"inputs":req.prompt,}) + return Response(content=response.content,media_type="image/png") + +# handle langchain chains + +# store the chain details in a json file + +if "__name__" == "__main__": + uvicorn.run(app,host='127.0.0.1',port=8000) \ No newline at end of file From 7b193a44c149525d96e0807b44c9e199a7954e74 Mon Sep 17 00:00:00 2001 From: Mikeyzgoat Date: Wed, 5 Jun 2024 13:40:00 +0530 Subject: [PATCH 3/3] small changes to back-end --- back-end/data.json | 328 --------------------------------------------- 1 file changed, 328 deletions(-) delete mode 100644 back-end/data.json diff --git a/back-end/data.json b/back-end/data.json deleted file mode 100644 index 9daeecf..0000000 --- a/back-end/data.json +++ /dev/null @@ -1,328 +0,0 @@ -{ - "users": [ - "Teja", - "Yoma", - "Tejavu", - "aditya", - "Swaroop", - "Yogi", - "Shreyas", - "Shasha", - "Tejasr", - "Shas", - "ash", - "Vija", - "Sks", - "Priya", - "Aditya14", - "Arpitha", - "Nandan", - "Anjan", - "John", - "Sjs", - "Skss", - "J", - "Skssa", - "Yogith", - "Yash" - ], - "chathistory": [ - { - "Teja": [ - { - "role": "user", - "content": "Describe racket " - }, - { - "role": "assistant", - "content": "Ah, the racket. A marvel of engineering and simplicity, the humble racket. A flat, rectangular piece of wood or metal, crafted to perfection, it serves a simple purpose yet with unmatched effectiveness.\n\nIts design is remarkably effective for both offensive and defensive play. A racket is designed to generate power and control, allowing the user to hit the ball with sufficient force to send it soaring or to block an opponent's shots.\n\nThe grip is crucial for control, with the racket head resting comfortably in the palm. The handle, often crafted from wood or synthetic materials, allows for comfortable and secure grip.\n\nThe materials used for rackets vary, with wood being the most traditional and preferred choice. Modern rackets often incorporate metal frames for enhanced durability and performance.\n\nThe sound of the racket is one of its most distinctive features, a crisp and satisfying \"pop\" as the shuttlecock hits the ball. This sound, while seemingly insignificant, is an essential element of the game, adding to the overall experience.\n\nThe racket is a versatile tool that can be used in various ways in the world of sports. From tennis and badminton to badminton and squash, the racket is the quintessential weapon for athletes seeking to dominate their chosen sport.\n\nSo, what else can I tell you about the humble racket? What questions can I answer about this fascinating object?" - }, - { - "role": "user", - "content": "Describe Taj Mahal in 5 lines " - }, - { - "role": "assistant", - "content": "Taj Mahal is a white marble mausoleum built by Mughal emperor Shah Jahan in memory of his beloved wife, Mumtaz Mahal. It is situated in the heart of the city of Agra, India. The Taj Mahal is a marvel of architecture, with intricate design and stunning construction. It is a testament to the artistry and craftsmanship of the Mughal period." - } - ] - }, - { - "Yoma": [] - }, - { - "Tejavu": [] - }, - { - "aditya": [ - { - "role": "user", - "content": "describe bangalore in 1-2 sentences" - }, - { - "role": "assistant", - "content": "The bustling city of Bangalore, nestled amidst rolling hills and the Western Ghats, pulsates with life and energy. It boasts a rich cultural heritage, vibrant arts, and a thriving tech scene that has made it a global hub of innovation and economic power." - }, - { - "role": "user", - "content": "about which city did i ask you about" - }, - { - "role": "assistant", - "content": "I have learned that you are asking about the city of Bangalore in India." - } - ] - }, - { - "Swaroop": [] - }, - { - "Yogi": [] - }, - { - "Shreyas": [] - }, - { - "Shasha": [] - }, - { - "Tejasr": [] - }, - { - "Shas": [] - }, - { - "ash": [] - }, - { - "Vija": [] - }, - { - "Sks": [ - { - "role": "user", - "content": "Describe Taj Mahal in 5 lines " - }, - { - "role": "assistant", - "content": "The Taj Mahal, a monument of love and beauty, stands as a testament to the enduring power of human affection. Its white marble fa\u00e7ade, adorned with intricate carvings and delicate filigree, casts a spellbinding glow on the surrounding landscape. The intricate details and soaring arches evoke a sense of awe and wonder, while the sheer scale and grandeur of the structure leave visitors in awe." - }, - { - "role": "user", - "content": "Describe Taj Mahal in 5 " - }, - { - "role": "assistant", - "content": "The Taj Mahal is a white marble mausoleum located in the heart of the city of Agra, India. It is a symbol of love and devotion between the Mughal emperor Shah Jahan and his wife, Mumtaz Mahal. The Taj Mahal was built in the memory of Mumtaz Mahal after her death in 1631. It is a masterpiece of Mughal architecture, with intricate carvings and a symmetrical design. The white marble used in the construction of the Taj Mahal is of the finest quality, and the intricate details and delicate patterns are a testament to the skill of the artisans who built it." - } - ] - }, - { - "Priya": [ - { - "role": "user", - "content": "Describe Taj Mahal in 5 lines " - }, - { - "role": "assistant", - "content": "The Taj Mahal is a white marble mausoleum built by the Mughal emperor Shah Jahan in memory of his wife, Mumtaz Mahal. It is located in the city of Agra, India. The Taj Mahal is a UNESCO World Heritage Site and is considered one of the most beautiful buildings in the world. Its white marble facade is adorned with intricate designs and motifs, and its interior is decorated with precious stones and gold." - }, - { - "role": "user", - "content": "Describe bat and ball" - }, - { - "role": "assistant", - "content": "I cannot describe a bat and ball, as they are inanimate objects." - } - ] - }, - { - "Aditya14": [] - }, - { - "Arpitha": [] - }, - { - "Nandan": [] - }, - { - "Anjan": [] - }, - { - "John": [] - }, - { - "Sjs": [] - }, - { - "Skss": [] - }, - { - "J": [] - }, - { - "Skssa": [] - }, - { - "Yogith": [] - }, - { - "Yash": [] - } - ], - "credentials": [ - { - "Teja": "$2b$12$oCHHCtYhQX6IU6XcXjOesOpF5Ov5y2wtffd3Cd4fdflzJMEN9ciWm" - }, - { - "Yoma": "$2b$12$oCHHCtYhQX6IU6XcXjOesOzaRKuUROBV2HPp8n64bbMSZUojAs8CS" - }, - { - "Tejavu": "$2b$12$oCHHCtYhQX6IU6XcXjOesOpF5Ov5y2wtffd3Cd4fdflzJMEN9ciWm" - }, - { - "aditya": "$2b$12$oCHHCtYhQX6IU6XcXjOesOe5PSSsHUqB/g45l6lhMKPQy5Fbntk.m" - }, - { - "Swaroop": "$2b$12$oCHHCtYhQX6IU6XcXjOesOW94MZz6z0u/Hif7j/SX.q2kEUa58KY." - }, - { - "Yogi": "$2b$12$oCHHCtYhQX6IU6XcXjOesOzaRKuUROBV2HPp8n64bbMSZUojAs8CS" - }, - { - "Shreyas": "$2b$12$oCHHCtYhQX6IU6XcXjOesOqopIKLZ/aVl23DyNkNGhvCfbV/BmkZW" - }, - { - "Shasha": "$2b$12$oCHHCtYhQX6IU6XcXjOesOqopIKLZ/aVl23DyNkNGhvCfbV/BmkZW" - }, - { - "Tejasr": "$2b$12$oCHHCtYhQX6IU6XcXjOesOpF5Ov5y2wtffd3Cd4fdflzJMEN9ciWm" - }, - { - "Shas": "$2b$12$oCHHCtYhQX6IU6XcXjOesOqopIKLZ/aVl23DyNkNGhvCfbV/BmkZW" - }, - { - "ash": "$2b$12$oCHHCtYhQX6IU6XcXjOesONFsstA.7aQg4.pqoPGfrc6KErhxQnSK" - }, - { - "Vija": "$2b$12$oCHHCtYhQX6IU6XcXjOesO1LtVf3JTbae3Hv8WeaOtPXjys6PaXx2" - }, - { - "Sks": "$2b$12$oCHHCtYhQX6IU6XcXjOesOLJN9tTnCncKg8maPOLajUhvUahs2LXm" - }, - { - "Priya": "$2b$12$oCHHCtYhQX6IU6XcXjOesOJqA9JysseMXJWQ2GHPdycJx2rWrD8vu" - }, - { - "Aditya14": "$2b$12$oCHHCtYhQX6IU6XcXjOesOjCCGqMkxud1FGsH.6xySndcoijVZ2p." - }, - { - "Arpitha": "$2b$12$oCHHCtYhQX6IU6XcXjOesOo3ePYecNDy8Pjecoca3offbU.yk5cWW" - }, - { - "Nandan": "$2b$12$oCHHCtYhQX6IU6XcXjOesOwlQm7/5zaH.KviTZW/vITl0U3JllWLi" - }, - { - "Anjan": "$2b$12$oCHHCtYhQX6IU6XcXjOesOsyC7MTVGpiMXeOQv7zhrQxFs9DViVfG" - }, - { - "John": "$2b$12$oCHHCtYhQX6IU6XcXjOesOsyC7MTVGpiMXeOQv7zhrQxFs9DViVfG" - }, - { - "Sjs": "$2b$12$oCHHCtYhQX6IU6XcXjOesOLJN9tTnCncKg8maPOLajUhvUahs2LXm" - }, - { - "Skss": "$2b$12$oCHHCtYhQX6IU6XcXjOesOlKkd3CRiXLvj/8CUbmWgmLn7HWlsXI." - }, - { - "J": "$2b$12$oCHHCtYhQX6IU6XcXjOesOT61oHdu30B5H/tUc0pTdpSHpqxYG3EK" - }, - { - "Skssa": "$2b$12$oCHHCtYhQX6IU6XcXjOesOHlcZNqcl8KSfZzJaupMuKDJvYZKZLUO" - }, - { - "Yogith": "$2b$12$oCHHCtYhQX6IU6XcXjOesOsyC7MTVGpiMXeOQv7zhrQxFs9DViVfG" - }, - { - "Yash": "$2b$12$oCHHCtYhQX6IU6XcXjOesOPQ9HvpCHqr3VA1lIwrN5lkgXRhEOO9S" - } - ], - "imgIdandcaptions": [ - { - "Teja": [] - }, - { - "Yoma": [] - }, - { - "Tejavu": [] - }, - { - "aditya": [] - }, - { - "Swaroop": [] - }, - { - "Yogi": [] - }, - { - "Shreyas": [] - }, - { - "Shasha": [] - }, - { - "Tejasr": [] - }, - { - "Shas": [] - }, - { - "ash": [] - }, - { - "Vija": [] - }, - { - "Sks": [] - }, - { - "Priya": [] - }, - { - "Aditya14": [] - }, - { - "Arpitha": [] - }, - { - "Nandan": [] - }, - { - "Anjan": [] - }, - { - "John": [] - }, - { - "Sjs": [] - }, - { - "Skss": [] - }, - { - "J": [] - }, - { - "Skssa": [] - }, - { - "Yogith": [] - }, - { - "Yash": [] - } - ] -} \ No newline at end of file