Kushagra Gaur commited on
Commit
8b853ad
·
1 Parent(s): 608045d

Fixed Merge Conflicts and added Streaming of Messages for improved speed of Model

Browse files
Files changed (4) hide show
  1. .gitignore +1 -0
  2. README.md +2 -30
  3. app.py +6 -4
  4. uv.lock +1 -1
.gitignore CHANGED
@@ -1,2 +1,3 @@
1
  .venv/
 
2
 
 
1
  .venv/
2
+ desktop.ini
3
 
README.md CHANGED
@@ -12,24 +12,10 @@ hf_oauth_scopes:
12
  - inference-api
13
  ---
14
 
15
- <<<<<<< HEAD
16
- <<<<<<< HEAD
17
  # 🎓 EEE_AI: Specialized Pedagogical Agent
18
  ### Powered by Llama-3.1-8B-Instant & Groq LPU™
19
 
20
  **EEE_AI** is an AI-driven tutoring system designed to assist students with the fundamentals of **Electrical and Electronics Engineering (EEE)**. This project serves as a bridge between high-performance LLM engineering and domain-specific educational technology.
21
- =======
22
- # 🎓 EEE-Educator: Specialized Pedagogical Agent
23
- ### Powered by Llama-3.1-8B-Instant & Groq LPU™
24
-
25
- **EEE-Educator** is an AI-driven tutoring system designed to assist students with the fundamentals of **Electrical and Electronics Engineering (EEE)**. This project serves as a bridge between high-performance LLM engineering and domain-specific educational technology.
26
- >>>>>>> 552bc50 (Initial clean commit for EEE AI)
27
- =======
28
- # 🎓 EEE_AI: Specialized Pedagogical Agent
29
- ### Powered by Llama-3.1-8B-Instant & Groq LPU™
30
-
31
- **EEE_AI** is an AI-driven tutoring system designed to assist students with the fundamentals of **Electrical and Electronics Engineering (EEE)**. This project serves as a bridge between high-performance LLM engineering and domain-specific educational technology.
32
- >>>>>>> ecf2431 (Updated README Correcting the Model Name)
33
 
34
  ---
35
 
@@ -53,26 +39,12 @@ As an AIML student, I built this space to explore the limits of **low-latency in
53
 
54
  ## 📖 Sample Interactions
55
  > **User:** "Explain KVL in simple terms."
56
- <<<<<<< HEAD
57
- <<<<<<< HEAD
58
- > **EEE_AI:** [Provides explanation] + "Would you like a practice circuit problem to test this law?"
59
-
60
- > **User:** "What's the best movie to watch tonight?"
61
- > **EEE_AI:** "I am focused on your engineering success! Let's get back to EEE—perhaps we can discuss how Signal Processing is used in movie audio instead?"
62
- =======
63
- > **EEE-AI:** [Provides explanation] + "Would you like a practice circuit problem to test this law?"
64
-
65
- > **User:** "What's the best movie to watch tonight?"
66
- > **EEE-AI:** "I am focused on your engineering success! Let's get back to EEE—perhaps we can discuss how Signal Processing is used in movie audio instead?"
67
- >>>>>>> 552bc50 (Initial clean commit for EEE AI)
68
- =======
69
  > **EEE_AI:** [Provides explanation] + "Would you like a practice circuit problem to test this law?"
70
 
71
  > **User:** "What's the best movie to watch tonight?"
72
  > **EEE_AI:** "I am focused on your engineering success! Let's get back to EEE—perhaps we can discuss how Signal Processing is used in movie audio instead?"
73
- >>>>>>> ecf2431 (Updated README Correcting the Model Name)
74
 
75
  ---
76
  ## 👷 About the Developer
77
- **Kushagra Gaur** | *Curious from Core* |
78
- This project was developed to master the integration of high-speed inference APIs and the implementation of domain-specific constraints in LLMs.
 
12
  - inference-api
13
  ---
14
 
 
 
15
  # 🎓 EEE_AI: Specialized Pedagogical Agent
16
  ### Powered by Llama-3.1-8B-Instant & Groq LPU™
17
 
18
  **EEE_AI** is an AI-driven tutoring system designed to assist students with the fundamentals of **Electrical and Electronics Engineering (EEE)**. This project serves as a bridge between high-performance LLM engineering and domain-specific educational technology.
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  ---
21
 
 
39
 
40
  ## 📖 Sample Interactions
41
  > **User:** "Explain KVL in simple terms."
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  > **EEE_AI:** [Provides explanation] + "Would you like a practice circuit problem to test this law?"
43
 
44
  > **User:** "What's the best movie to watch tonight?"
45
  > **EEE_AI:** "I am focused on your engineering success! Let's get back to EEE—perhaps we can discuss how Signal Processing is used in movie audio instead?"
 
46
 
47
  ---
48
  ## 👷 About the Developer
49
+ **Kushagra Gaur** | *Curious from Core*
50
+ This project was developed to master the integration of high-speed inference APIs and the implementation of domain-specific constraints in LLMs.
app.py CHANGED
@@ -4,7 +4,6 @@ from openai import OpenAI
4
  from dotenv import load_dotenv
5
 
6
 
7
-
8
  load_dotenv()
9
 
10
  client = OpenAI(
@@ -12,7 +11,6 @@ client = OpenAI(
12
  api_key=os.getenv("GROQ_API_KEY")
13
  )
14
 
15
-
16
  system_prompt = "You are an assistant by the name EEE_AI based on Llama 3.1:8B Instant that is a University Level Expert in BEEE which is Basics of Electrical and Electronics Engineering \
17
  and provides detail university level answers to questions asked by students, you make sure the questions are relevent to the given syllabus or not.\
18
  Also as you are an expert so you explain like an expert too, You first explain in vast detail and then provide a short summary of all you said \
@@ -36,12 +34,16 @@ def chat(message, history):
36
 
37
  messages.append({"role": "user", "content": message})
38
 
39
- response = client.chat.completions.create(
40
  model="llama-3.1-8b-instant",
41
  messages=messages
 
42
  )
 
 
 
 
43
 
44
- return response.choices[0].message.content
45
 
46
  gr.ChatInterface(
47
  fn=chat,
 
4
  from dotenv import load_dotenv
5
 
6
 
 
7
  load_dotenv()
8
 
9
  client = OpenAI(
 
11
  api_key=os.getenv("GROQ_API_KEY")
12
  )
13
 
 
14
  system_prompt = "You are an assistant by the name EEE_AI based on Llama 3.1:8B Instant that is a University Level Expert in BEEE which is Basics of Electrical and Electronics Engineering \
15
  and provides detail university level answers to questions asked by students, you make sure the questions are relevent to the given syllabus or not.\
16
  Also as you are an expert so you explain like an expert too, You first explain in vast detail and then provide a short summary of all you said \
 
34
 
35
  messages.append({"role": "user", "content": message})
36
 
37
+ stream = client.chat.completions.create(
38
  model="llama-3.1-8b-instant",
39
  messages=messages
40
+ stream = True
41
  )
42
+ result=""
43
+ for chunk in stream:
44
+ result+=chunk.choices[0].delta.content or ""
45
+ yield result
46
 
 
47
 
48
  gr.ChatInterface(
49
  fn=chat,
uv.lock CHANGED
@@ -1,3 +1,3 @@
1
  version = 1
2
  revision = 3
3
- requires-python = ">=3.12.12"
 
1
  version = 1
2
  revision = 3
3
+ requires-python = ">=3.12.12"