Aranwer commited on
Commit
6cbb352
·
verified ·
1 Parent(s): 1b81753

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -9,7 +9,6 @@ import numpy as np
9
  # Set your API keys as HF secrets or environment variables
10
  os.environ["MISTRAL_API_KEY"] = "cNjUx79Hl0A2AeiAMf6yi7o7ah4APoZy"
11
  os.environ["GROQ_API_KEY"] = "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"
12
-
13
  game_state = {
14
  "active": False,
15
  "questions_asked": 0,
@@ -39,7 +38,7 @@ def transcribe_audio(audio, language):
39
  return text.lower()
40
  except Exception as e:
41
  print(f"Transcription error: {e}")
42
- return "❌ Could not transcribe the audio."
43
 
44
  def handle_user_question(user_question):
45
  if not game_state["consult_mode"]:
@@ -151,7 +150,8 @@ def process_answer(answer_text):
151
  def toggle_consult_mode():
152
  game_state["consult_mode"] = not game_state["consult_mode"]
153
  return ("🔔 Consult Mode: ON" if game_state["consult_mode"] else "🔕 Consult Mode: OFF",
154
- gr.update(visible=game_state["consult_mode"]))
 
155
 
156
  def get_consult_hint():
157
  if not game_state["active"] or not game_state["consult_mode"]:
@@ -159,7 +159,7 @@ def get_consult_hint():
159
  return get_hint(game_state["current_question"], game_state["answers"])
160
 
161
  # Colorful and polished UI
162
- with gr.Blocks(css="") as demo:
163
  gr.Markdown("## 🧠 Kasoti: 20 Questions AI Game")
164
  gr.Markdown("Think of a person, place, or thing. I'll try to guess it in 20 questions or less!")
165
 
 
9
  # Set your API keys as HF secrets or environment variables
10
  os.environ["MISTRAL_API_KEY"] = "cNjUx79Hl0A2AeiAMf6yi7o7ah4APoZy"
11
  os.environ["GROQ_API_KEY"] = "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"
 
12
  game_state = {
13
  "active": False,
14
  "questions_asked": 0,
 
38
  return text.lower()
39
  except Exception as e:
40
  print(f"Transcription error: {e}")
41
+ return ""
42
 
43
  def handle_user_question(user_question):
44
  if not game_state["consult_mode"]:
 
150
  def toggle_consult_mode():
151
  game_state["consult_mode"] = not game_state["consult_mode"]
152
  return ("🔔 Consult Mode: ON" if game_state["consult_mode"] else "🔕 Consult Mode: OFF",
153
+ gr.update(visible=game_state["consult_mode"]),
154
+ consult_row.update(visible=game_state["consult_mode"])) # Fix for consult row visibility toggle
155
 
156
  def get_consult_hint():
157
  if not game_state["active"] or not game_state["consult_mode"]:
 
159
  return get_hint(game_state["current_question"], game_state["answers"])
160
 
161
  # Colorful and polished UI
162
+ with gr.Blocks(css="body {background-color: #f7f7f7;}") as demo:
163
  gr.Markdown("## 🧠 Kasoti: 20 Questions AI Game")
164
  gr.Markdown("Think of a person, place, or thing. I'll try to guess it in 20 questions or less!")
165