EMsurya commited on
Commit
5e9fc14
Β·
verified Β·
1 Parent(s): ba6cd1d

to return json

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -117,7 +117,7 @@ class SimilarityModel:
117
  try:
118
  assert isinstance(tools_data, list) and all(isinstance(d, dict) for d in tools_data)
119
  except AssertionError:
120
- return tools_data, [{"Error": tools_data}]
121
 
122
  # Create a unique key for caching based on the tools data
123
  tools_cache_key = json.dumps(tools_data, sort_keys=True)
@@ -150,7 +150,7 @@ class SimilarityModel:
150
  if not top_tools:
151
  output_text = "No tools found."
152
 
153
- return output_text, top_tools
154
 
155
  def create_ui(model: SimilarityModel):
156
  """Pretty UI with Gradio for user to interact with"""
@@ -161,7 +161,7 @@ def create_ui(model: SimilarityModel):
161
  inputs=[
162
  gr.Textbox(label="Query"),
163
  gr.Textbox(
164
- lines=10,
165
  label="Define tool declaration here",
166
  info="Please enter a valid JSON string. For e.g, a list of dict's (name & desc πŸ‘).",
167
  placeholder='''[
 
117
  try:
118
  assert isinstance(tools_data, list) and all(isinstance(d, dict) for d in tools_data)
119
  except AssertionError:
120
+ return tools_data, json.dumps([{"Error": tools_data}])
121
 
122
  # Create a unique key for caching based on the tools data
123
  tools_cache_key = json.dumps(tools_data, sort_keys=True)
 
150
  if not top_tools:
151
  output_text = "No tools found."
152
 
153
+ return output_text, json.dumps(top_tools)
154
 
155
  def create_ui(model: SimilarityModel):
156
  """Pretty UI with Gradio for user to interact with"""
 
161
  inputs=[
162
  gr.Textbox(label="Query"),
163
  gr.Textbox(
164
+ lines=6,
165
  label="Define tool declaration here",
166
  info="Please enter a valid JSON string. For e.g, a list of dict's (name & desc πŸ‘).",
167
  placeholder='''[