Rakshitjan commited on
Commit
2da5a97
·
verified ·
1 Parent(s): 49e1116

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +14 -0
  2. main.py +38 -0
  3. requirements.txt +3 -0
Dockerfile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+
4
+ FROM python:3.9
5
+
6
+ WORKDIR /code
7
+
8
+ COPY ./requirements.txt /code/requirements.txt
9
+
10
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
11
+
12
+ COPY . .
13
+
14
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
main.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from groq import Groq
3
+ import os
4
+ apikey = os.getenv('API_KEY')
5
+ app = FastAPI()
6
+
7
+ client = Groq(
8
+ api_key=apikey,
9
+ )
10
+
11
+ @app.post("/chat")
12
+ async def chat(query: str):
13
+ chat_completion = client.chat.completions.create(
14
+ messages=[
15
+ {
16
+ "role": "system",
17
+ "content": """Generate me 10 MCQ type questions on the topic asked by the user of Joint Entrance Examination level and also explain the solution of each problem step-wise. And also give a hardness rating out of 100 , The questions should have difficulty matching with the level of JEE mains and advanced.
18
+ Give me questions which are of very high difficulty level.
19
+ Make sure you provide VERY VERY Advanced level questions which cover the given topic properly , also the solutions or Hints has to be really relevant and explainatory.
20
+ Expected output format:
21
+ {"response":"Here are 10 MCQ type questions on the topic of Equilibrium at the level of Joint Entrance Examination (JEE):\n\n**Question 1:**\nQuestion: A container having a fixed volume of 1 liter is filled with 1 mole of a gas. The temperature of the system is increased from 27°C to 127°C. The entropy change of the system is (R = 8.314 J/mol-K)\nOptions: 23.4 J/mol-K,,, 46.8 J/mol-K,,, 29.3 J/mol-K,,, 58.6 J/mol-K\nAnswer: 23.4 J/mol-K\nHardness rating: 80\nSolution: The entropy change of an ideal gas can be calculated using the formula ΔS = nR ln(V2/V1) + nCp ln(T2/T1). Since the volume is constant, the first term is zero. Plugging in the values, we get ΔS = 1 Ô 8.314 Ô ln(400/300) = 23.4 J/mol-K.\n\n**Question 2:**\nQuestion: A gas phase reaction A └ B is in equilibrium at a certain temperature. If the initial concentration of A is 2M and the equilibrium concentration of A is 1.5M, what is the equilibrium constant (Kc) of the reaction?\nOptions: 0.25,,, 1/3,,, 0.5,,, 1/4\nAnswer: 0.5\nHardness rating: 70\nSolution: Let the initial concentration of A be a, and the equilibrium concentrations of A and B be a-x and x respectively. Then, Kc = [B]/[A] = x/(a-x). Plugging in the values, we get Kc = (0.5)/(1.5) = 0.5.\n\n**Question 3:**\nQuestion: A 1L container is divided into two compartments of equal volume by a piston. One compartment contains 1 mole of an ideal gas at 300K, and the other compartment is evacuated. If the piston is removed and the system is allowed to reach equilibrium, what is the final temperature of the system? (R = 8.314 J/mol-K)\nOptions: 225 K,,, 300 K,,, 450 K,,, 600 K\nAnswer: 300 K\nHardness rating: 90\nSolution: Since the system is isolated, the total internal energy remains constant. The initial energy of the system is (3/2)nRT = (3/2) Ô 1 Ô 8.314 Ô 300 = 3741 J. After the piston is removed, the gas expands to double its volume, and the final temperature can be calculated using the formula U = (3/2)nRT. Plugging in the values, we get T = 300 K.\n\n**Question 4:**\nQuestion: The equilibrium constant (Kp) for the reaction CO(g) + Cl2(g) └ COCl2(g) is 3.4 Ô 10^3 at 700K. If the initial pressures of CO and Cl2 are 0.1 atm and 0.2 atm respectively, what is the equilibrium pressure of COCl2?\nOptions: 0.68 atm,,, 1.36 atm,,, 2.04 atm,,, 3.4 atm\nAnswer: 0.68 atm\nHardness rating: 85\nSolution: Let the initial pressures of CO, Cl2, and COCl2 be p, 2p, and 0 respectively. At equilibrium, the pressures are p-x, 2p-x, and x respectively. The equilibrium constant can be expressed as Kp = x/(p-x)(2p-x). Plugging in the values, we get x = 0.68 atm.\n\n**Question 5:**\nQuestion: The standard Gibbs free energy change (ΔG°) for a reaction is -20 kJ/mol at 298K. What is the equilibrium constant (K) for the reaction?\nOptions: 10^3,,, 10^4,,, 10^5,,, 10^6\nAnswer: 10^4\nHardness rating: 75\nSolution: The equilibrium constant can be calculated using the formula ΔG° = -RT lnK. Plugging in the values, we get lnK = 20/(-8.314 Ô 298) = 8.14. Therefore, K = 10^4.\n\n**Question 6:**\nQuestion: A reaction A + B └ C + D has an equilibrium constant(Kc) of 4 at a certain temperature. If the initial concentrations of A, B, and C are 2M, 3M, and 1M respectively, what is the equilibrium concentration o ?\nOptions: 1M,,, 2M,,, 3M,,, 4M\nAnswer: 2M\nHardness rating: 80\nSolution: Let the equilibrium concentrations of A, B, C, and D be a-x, b-x, c+x, and x respectively. The equilibrium constant can be expressed as Kc = (c+x)(x)/(a-x)(bx) = 4. Plugging in the values, we get x = 2M.\n\n**Question 7:**\nQuestion: The equilibrium constant (Kp) for the reaction H2(g) + I2(g) └ 2HI(g) is 50 at a certain temperature. If the initial pressures of H2 and I2 are 1 atm and 2 atm respectively, what is the degree of dissociation of HI at equilibrium?\nOptions: 0.4,,, 0.6,,, 0.8,,, 0.9\nAnswer: 0.8\nHardness rating: 90\nSolution: Let the initial pressures of H2, I2, and HI be p, 2p, and 0 respectively. At equilibrium, the pressures are p-x, 2p-x, and 2x respectively. The equilibrium constant can be expressed as Kp = (2x)^2/(px)(2p-x) = 50. Plugging in the values, we get x = 0.8p. Therefore, the degree of dissociation is 0.8.\n\n**Question 8:**\nQuestion: A reaction A └ B is in equilibrium at a certain temperature. If the entropy of A and B are 200 J/mol-K and 250 J/mol-K respectively, what is the equilibrium constant (K) of the reaction?\nOptions: 2,,, 4,,, 6,,, 8\nAnswer:4\nHardness rating: 80\nSolution: The equilibrium constant can be calculated using the formula ΔG° = -RT lnK = ΔH° - TΔS°. Since the reaction is at equilibrium, ΔG° = 0. Plugging in the values, we get ΔH° = TΔS°. Therefore, K = exp(ΔS°/R) = 4.\n\n**Question 9:**\nQuestion: The equilibrium constant (Kc) for the reaction A + 2B └ C is 10 at a certain temperature. If the initial concentrations of A and B are 1M and 2M respectively, what is the equilibrium concentration of C?\nOptions: 1M,,, 2M,,, 4M,,, 6M\nAnswer: 2M\nHardness rating: 85\nSolution: Let the equilibrium concentrations of A, B, and C be a-x, b-2x, and x respectively. The equilibrium constant can be expressed as Kc = x/(a-x)(b-2x)^2 = 10. Plugging in the values, we get x = 2M.\n\n**Question 10:**\nQuestion: A 2L container is divided into two compartments of equal volume by a piston. One compartment contains 1 mole of an ideal gas at 300K, and the other compartment is evacuated. If the piston is removed and the system is allowed to reach equilibrium, what is the final entropy of the system? (R = 8.314 J/mol-K)\nOptions: 23.4 J/mol-K,,, 46.8 J/mol-K,,, 58.6 J/mol-K,,, 69.4 J/mol-K\nAnswer: 46.8 J/mol-K\nHardness rating: 95\nSolution: Since the system is isolated, the total internal energy remains constant. The initial energy of the system is (3/2)nRT = (3/2) Ô 1 Ô 8.314 Ô 300 = 3741 J. After the piston is removed, the gas expands to double its volume, and the final entropy can be calculated using the formula ΔS = nR ln(V2/V1) + nCp ln(T2/T1). Since the temperature remains constant, the second term is zero. Plugging in the values, we get ΔS = 1 Ô 8.314 Ô ln(2) = 5.763 J/mol-K. Therefore,the final entropy is 23.4 + 5.763 = 46.8 J/mol-K."}
22
+
23
+ VERY IMPORTANT : MAKE SURE YOU STRICTLT FOLLOW THE OUTPUT FORMAT .
24
+ VERY IMPORTANT : MAKE SURE THE GIVEN ANSWER FOR EVERY QUESTION EXISTS IN ANY OF THE FOUR OPTIONS.
25
+ VERY IMPORTANT : MAKE SURE WE PUT ",,," BETWEEN OPTIONS TO DIFFERENTIATE WELL For Example : Options : A,,,B,,,C,,,D
26
+
27
+
28
+ """
29
+ },
30
+ {
31
+ "role": "user",
32
+ "content": query,
33
+ }
34
+ ],
35
+ model="llama3-70b-8192",
36
+ )
37
+
38
+ return {"response": chat_completion.choices[0].message.content}
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ fastapi
2
+ uvicorn
3
+ groq