danishmuhammad commited on
Commit
dc46cc1
·
verified ·
1 Parent(s): 9cb965d

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +3 -4
index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.6.0';
2
 
3
  // Since we will download the model from the Hugging Face Hub, we can skip the local model check
4
  env.allowLocalModels = false;
5
 
6
- const answerer = await pipeline('question-answering', 'Xenova/distilbert-base-uncased-distilled-squad');
7
  var chatBox = document.getElementById("chat-box");
8
  const sendMessageButton = document.getElementById('send-btn');
9
 
@@ -21,8 +21,7 @@ function sendMessage() {
21
 
22
  // Detect objects in the image
23
  async function getAnswer(question) {
24
- const context = 'Chemistry is the study of the properties of matter, how matter changes and what it’s made of.We can break down almost everything in the universe into tiny particles called atoms. There are 119 types of atoms in the universe. Groups of atoms bonded together are called molecules. In a chemical reaction, molecules rearrange themselves to make multitudes of materials and substances that exist today. Every material has a specific composition of atoms which we express as a chemical formula.H2O is the chemical formula for water.This means that a water molecule has two hydrogen (H) atoms and one oxygen (O) atom.In chemistry, you will learn the formulae for various materials and how to combine molecules in reactions. You will also learn how atoms make electricity and energy.The topics covered in chemistry come under three main sections: Physical Chemistry, Inorganic Chemistry and Organic Chemistry.physical chemistry is a study of how atoms behave. If you were to look into an atom you would see that it’s made of other tiny sub-particles called electrons, protons and neurons. Every atom has a unique arrangement of sub-particles (Atomic Structure). Atomic structure affects how atoms bond with each other (Atomic Bonding) and how they respond to heat (Thermodynamics).In inorganic chemistry, we will explore the periodic table. You will learn how we ended up with all the elements we see on it today and discover why Mendeleev arranged the elements that way. You will also learn about the similarities and differences in their properties, and how we use them in chemistry.Organic chemistry is the study of materials that contain carbon. ‘Organic’ means derived from living things. We call this field organic chemistry because scientists previously thought that we could only find organic compounds in living matter and they couldn’t be made artificially. Today, we know this is not true - we can manufacture numerous organic compounds in laboratories.Even though organic chemistry mostly focuses on carbon, it is the second-largest section in chemistry. This is because carbon can combine with other elements to form a vast array of fascinating molecules, structures and compounds! Carbon bonds covalently with elements like hydrogen, oxygen and nitrogen to make long complex repeating chains that form a variety of fantastic materials that we use today. Among the materials you will learn about in organic chemistry are alcohols and polymers. ';
25
- const output = await answerer(question, context);
26
  setTimeout(function() {
27
  chatBox.innerHTML += "<p class='bot-message'><strong>Chatbot:</strong> " + output.answer + "</p>";
28
  // Scroll to bottom of chat box
 
1
+ import { pipeline, env } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers";
2
 
3
  // Since we will download the model from the Hugging Face Hub, we can skip the local model check
4
  env.allowLocalModels = false;
5
 
6
+ const answerer = await pipeline('question-answering', 'danishmuhammad/ccat_2025_llama3.1_8B');
7
  var chatBox = document.getElementById("chat-box");
8
  const sendMessageButton = document.getElementById('send-btn');
9
 
 
21
 
22
  // Detect objects in the image
23
  async function getAnswer(question) {
24
+ const output = await answerer(question);
 
25
  setTimeout(function() {
26
  chatBox.innerHTML += "<p class='bot-message'><strong>Chatbot:</strong> " + output.answer + "</p>";
27
  // Scroll to bottom of chat box