madoss commited on
Commit
cb97f50
1 Parent(s): 804f1ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -37,19 +37,19 @@ def search(query, k):
37
  "link": url,
38
  }
39
  results.append(result)
40
- return results
 
 
 
 
41
 
42
  iface = gr.Interface(
43
  search,
44
  inputs=[
45
- gr.inputs.Textbox(label="Query"),
46
  gr.inputs.Number(label="K", default=3),
47
  ],
48
- outputs=[
49
- gr.outputs.Textbox(label="Result 1"),
50
- gr.outputs.Textbox(label="Result 2"),
51
- gr.outputs.Textbox(label="Result 3")
52
- ],
53
  title="Camembert and Faiss-powered Search Engine",
54
  description="Search through a dataset using Camembert and Faiss",
55
  theme="light",
 
37
  "link": url,
38
  }
39
  results.append(result)
40
+
41
+ # Format results as a single string for single textbox output
42
+ results_text = ("\n" + "*" * 15 + "\n").join([f'Title: {r["title"]}\nTranscript: {r["transcript"]}\nLink: {r["link"]}' for r in results])
43
+
44
+ return {"Result": results_text}
45
 
46
  iface = gr.Interface(
47
  search,
48
  inputs=[
49
+ gr.inputs.Textbox(label="Query", default="This is an example query"), # Adding a default example
50
  gr.inputs.Number(label="K", default=3),
51
  ],
52
+ outputs=gr.outputs.Textbox(label="Result"), # Using single textbox for output
 
 
 
 
53
  title="Camembert and Faiss-powered Search Engine",
54
  description="Search through a dataset using Camembert and Faiss",
55
  theme="light",