Spaces:
Sleeping
Sleeping
James MacQuillan
commited on
Commit
·
388d28b
1
Parent(s):
f313407
push
Browse files
app.py
CHANGED
@@ -92,7 +92,7 @@ def search(query):
|
|
92 |
|
93 |
def process_query(user_input, history):
|
94 |
|
95 |
-
|
96 |
|
97 |
# Step 1: Generate a search term based on the user query
|
98 |
stream_search = client.chat_completion(
|
@@ -110,7 +110,7 @@ def process_query(user_input, history):
|
|
110 |
|
111 |
# Step 2: Perform the web search with the generated term
|
112 |
|
113 |
-
|
114 |
search_results = search(search_query)
|
115 |
|
116 |
# Format results as a JSON string for model input
|
@@ -125,13 +125,13 @@ def process_query(user_input, history):
|
|
125 |
)
|
126 |
|
127 |
|
128 |
-
|
129 |
# Stream final response
|
130 |
final_response = ""
|
131 |
for chunk in response:
|
132 |
content = chunk.choices[0].delta.content or ''
|
133 |
final_response += content
|
134 |
-
yield
|
135 |
|
136 |
theme = gr.themes.Citrus(
|
137 |
primary_hue="blue",
|
@@ -165,14 +165,7 @@ examples = [
|
|
165 |
["What are the top-rated ETFs for technology exposure this quarter?"]
|
166 |
]
|
167 |
|
168 |
-
|
169 |
-
label="IM.S",
|
170 |
-
avatar_images=[None, BOT_AVATAR],
|
171 |
-
show_copy_button=True,
|
172 |
-
layout="panel",
|
173 |
-
height=700,
|
174 |
-
type='messages'
|
175 |
-
)
|
176 |
|
177 |
with gr.Blocks(theme=theme) as demo:
|
178 |
with gr.Column():
|
@@ -181,7 +174,7 @@ with gr.Blocks(theme=theme) as demo:
|
|
181 |
with gr.Column(scale=3, min_width=600):
|
182 |
chat_interface = gr.ChatInterface(
|
183 |
fn=process_query,
|
184 |
-
|
185 |
examples=examples
|
186 |
)
|
187 |
|
|
|
92 |
|
93 |
def process_query(user_input, history):
|
94 |
|
95 |
+
|
96 |
|
97 |
# Step 1: Generate a search term based on the user query
|
98 |
stream_search = client.chat_completion(
|
|
|
110 |
|
111 |
# Step 2: Perform the web search with the generated term
|
112 |
|
113 |
+
|
114 |
search_results = search(search_query)
|
115 |
|
116 |
# Format results as a JSON string for model input
|
|
|
125 |
)
|
126 |
|
127 |
|
128 |
+
|
129 |
# Stream final response
|
130 |
final_response = ""
|
131 |
for chunk in response:
|
132 |
content = chunk.choices[0].delta.content or ''
|
133 |
final_response += content
|
134 |
+
yield final_response
|
135 |
|
136 |
theme = gr.themes.Citrus(
|
137 |
primary_hue="blue",
|
|
|
165 |
["What are the top-rated ETFs for technology exposure this quarter?"]
|
166 |
]
|
167 |
|
168 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
with gr.Blocks(theme=theme) as demo:
|
171 |
with gr.Column():
|
|
|
174 |
with gr.Column(scale=3, min_width=600):
|
175 |
chat_interface = gr.ChatInterface(
|
176 |
fn=process_query,
|
177 |
+
|
178 |
examples=examples
|
179 |
)
|
180 |
|