ShahbazAhmad-Lab commited on
Commit
e2d1297
·
verified ·
1 Parent(s): afe9e46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -3,15 +3,16 @@ import types
3
 
4
  # Fix for Python 3.13 audioop issue
5
  sys.modules['audioop'] = types.ModuleType('audioop')
 
6
  import os
7
  import sqlite3
8
  import gradio as gr
9
  from groq import Groq
10
 
11
- # Initialize Groq client (secure key)
12
  client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
13
 
14
- # Database setup
15
  conn = sqlite3.connect("timetable.db", check_same_thread=False)
16
  cursor = conn.cursor()
17
 
@@ -33,7 +34,6 @@ def add_class(day, time, subject, teacher, room):
33
  "SELECT * FROM timetable WHERE day=? AND time=? AND teacher=?",
34
  (day, time, teacher),
35
  )
36
-
37
  if cursor.fetchone():
38
  return "❌ Conflict: Teacher already assigned"
39
 
@@ -56,7 +56,7 @@ def view_timetable():
56
  [f"{r[0]} | {r[1]} | {r[2]} | {r[3]} | {r[4]}" for r in rows]
57
  )
58
 
59
- # AI Assistant
60
  def ai_assistant(prompt):
61
  cursor.execute("SELECT day, time, subject, teacher, room FROM timetable")
62
  data = cursor.fetchall()
 
3
 
4
  # Fix for Python 3.13 audioop issue
5
  sys.modules['audioop'] = types.ModuleType('audioop')
6
+
7
  import os
8
  import sqlite3
9
  import gradio as gr
10
  from groq import Groq
11
 
12
+ # Groq client
13
  client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
14
 
15
+ # Database
16
  conn = sqlite3.connect("timetable.db", check_same_thread=False)
17
  cursor = conn.cursor()
18
 
 
34
  "SELECT * FROM timetable WHERE day=? AND time=? AND teacher=?",
35
  (day, time, teacher),
36
  )
 
37
  if cursor.fetchone():
38
  return "❌ Conflict: Teacher already assigned"
39
 
 
56
  [f"{r[0]} | {r[1]} | {r[2]} | {r[3]} | {r[4]}" for r in rows]
57
  )
58
 
59
+ # AI assistant
60
  def ai_assistant(prompt):
61
  cursor.execute("SELECT day, time, subject, teacher, room FROM timetable")
62
  data = cursor.fetchall()