gaur3009 commited on
Commit
4e51f93
Β·
verified Β·
1 Parent(s): 863f6b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -32
app.py CHANGED
@@ -41,35 +41,4 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="violet")) as demo:
41
 
42
  btn.click(fn=ask_agent, inputs=inp, outputs=out)
43
 
44
- demo.launch()
45
-
46
- from googlesearch import search
47
-
48
- def search_google(query, num_results=5):
49
- """Search Google and return list of URLs."""
50
- return list(search(query, num_results=num_results))
51
-
52
-
53
- Make proper one cause it is showing this error and make a better like use Langchain for better one also make a good UI:
54
- Traceback (most recent call last):
55
- File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 626, in process_events
56
- response = await route_utils.call_process_api(
57
- File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 322, in call_process_api
58
- output = await app.get_blocks().process_api(
59
- File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2229, in process_api
60
- result = await self.call_function(
61
- File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1740, in call_function
62
- prediction = await anyio.to_thread.run_sync( # type: ignore
63
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
64
- return await get_async_backend().run_sync_in_worker_thread(
65
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2470, in run_sync_in_worker_thread
66
- return await future
67
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 967, in run
68
- result = context.run(func, *args)
69
- File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 940, in wrapper
70
- response = f(*args, **kwargs)
71
- File "/home/user/app/app.py", line 17, in ask_agent
72
- vs.add_texts(texts)
73
- File "/home/user/app/rag.py", line 19, in add_texts
74
- self.index = faiss.IndexFlatL2(new_embeds.shape[1])
75
- IndexError: tuple index out of range
 
41
 
42
  btn.click(fn=ask_agent, inputs=inp, outputs=out)
43
 
44
+ demo.launch()