tanyadhast commited on
Commit
df69d1a
·
verified ·
1 Parent(s): 0d1bc66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -12
app.py CHANGED
@@ -4,11 +4,11 @@ from huggingface_hub import InferenceClient
4
  from sentence_transformers import SentenceTransformer
5
  import torch
6
 
7
- #theme = gr.themes.Base(
8
- #primary_hue=gr.themes.Color(c100="#dbeafe", c200="#bfdbfe", c300="#93c5fd", c400="#60a5fa", c50="#eff6ff", c500="rgba(59.925932017543865, 128.98921451355668, 241.82500000000002, 1)", c600="#2563eb", c700="#1d4ed8", c800="#1e40af", c900="#1e3a8a", c950="#1d3660"),
9
- #secondary_hue="green",
10
- #)
11
- #with gr.Blocks(theme=theme) as demo:
12
 
13
  # SEMANTIC SEARCH STEP 2
14
  with open("songs_knowledge_base_2.txt", "r", encoding="utf-8") as file:
@@ -102,11 +102,6 @@ def get_top_chunks(query, chunk_embeddings, text_chunks):
102
  # Return the list of most relevant chunks
103
  return top_chunks
104
 
105
-
106
-
107
-
108
-
109
-
110
  client = InferenceClient('Qwen/Qwen2.5-7B-Instruct-1M')
111
  def respond(message, history):
112
  info = get_top_chunks(message, chunk_embeddings, cleaned_chunks)
@@ -126,5 +121,8 @@ def echo(message, history):
126
  def yes_no(message, history):
127
  responses = ["Yes", "No"]
128
  return random.choice(responses)
129
- chatbot = gr.ChatInterface(respond, type="messages", title = "AuxAI", description = "Hi! I’m AuxAI, your friendly music recommendation assistant. Tell me your mood, genre, or style and I’ll suggest some songs!")
130
- chatbot.launch()
 
 
 
 
4
  from sentence_transformers import SentenceTransformer
5
  import torch
6
 
7
+ theme = gr.themes.Base(
8
+ primary_hue=gr.themes.Color(c100="#dbeafe", c200="#bfdbfe", c300="#93c5fd", c400="#60a5fa", c50="#eff6ff", c500="rgba(59.925932017543865, 128.98921451355668, 241.82500000000002, 1)", c600="#2563eb", c700="#1d4ed8", c800="#1e40af", c900="#1e3a8a", c950="#1d3660"),
9
+ secondary_hue="green",
10
+ )
11
+
12
 
13
  # SEMANTIC SEARCH STEP 2
14
  with open("songs_knowledge_base_2.txt", "r", encoding="utf-8") as file:
 
102
  # Return the list of most relevant chunks
103
  return top_chunks
104
 
 
 
 
 
 
105
  client = InferenceClient('Qwen/Qwen2.5-7B-Instruct-1M')
106
  def respond(message, history):
107
  info = get_top_chunks(message, chunk_embeddings, cleaned_chunks)
 
121
  def yes_no(message, history):
122
  responses = ["Yes", "No"]
123
  return random.choice(responses)
124
+ with gr.Blocks(theme=theme) as chatbot:
125
+ with gr.Row():
126
+ gr.ChatInterface(respond, type="messages", title = "AuxAI", description = "Hi! I’m AuxAI, your friendly music recommendation assistant. Tell me your mood, genre, or style and I’ll suggest some songs!")
127
+
128
+ chatbot.launch()