kshahnathwani commited on
Commit
a12947f
·
verified ·
1 Parent(s): 7375397

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -44,7 +44,7 @@ Given a list of notes (like "C E G" or "D F# A C"), identify the chord name.
44
  Always respond with the chord name and a short explanation of the intervals.
45
  """
46
 
47
- # Read token from Secrets (set in Space -> Settings -> Repository secrets)
48
  HF_TOKEN = os.environ.get("HF_TOKEN")
49
 
50
  # Create inference client
@@ -61,13 +61,12 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
61
 
62
  for chunk in client.text_generation(
63
  prompt,
64
- model="google/flan-t5-small", # ✅ ensure correct model is used
65
  max_new_tokens=max_tokens,
66
  temperature=temperature,
67
  top_p=top_p,
68
  stream=True,
69
  ):
70
- # chunks are StreamingResponse objects
71
  if hasattr(chunk, "token") and chunk.token and chunk.token.text:
72
  token = chunk.token.text
73
  response += token
@@ -93,7 +92,7 @@ chatbot = gr.ChatInterface(
93
  )
94
 
95
  with gr.Blocks(css=fancy_css) as demo:
96
- gr.Markdown("<h1 id='title'>🎶 Chord Bot (API-based) 🎶</h1>")
97
  chatbot.render()
98
 
99
  if __name__ == "__main__":
 
44
  Always respond with the chord name and a short explanation of the intervals.
45
  """
46
 
47
+ # Read token from Space secrets
48
  HF_TOKEN = os.environ.get("HF_TOKEN")
49
 
50
  # Create inference client
 
61
 
62
  for chunk in client.text_generation(
63
  prompt,
64
+ model="microsoft/Phi-3-mini-4k-instruct", # ✅ causal LM
65
  max_new_tokens=max_tokens,
66
  temperature=temperature,
67
  top_p=top_p,
68
  stream=True,
69
  ):
 
70
  if hasattr(chunk, "token") and chunk.token and chunk.token.text:
71
  token = chunk.token.text
72
  response += token
 
92
  )
93
 
94
  with gr.Blocks(css=fancy_css) as demo:
95
+ gr.Markdown("<h1 id='title'>🎶 Chord Bot (API-based with Phi-3-mini) 🎶</h1>")
96
  chatbot.render()
97
 
98
  if __name__ == "__main__":