orderlymirror commited on
Commit
ca2f8d5
1 Parent(s): 24c237f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -38,13 +38,16 @@ from langchain.llms import OpenAI
38
 
39
  chain = load_qa_chain(OpenAI(), chain_type="stuff")
40
 
41
- query = "“Can you give me an example from history where the enemy was crushed totallyfrom the book?"
42
- docs = docsearch.similarity_search(query)
43
- chain.run(input_documents=docs, question=query)
44
-
45
-
46
- def greet():
47
- return "Hello"
48
-
49
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
50
  iface.launch()
 
38
 
39
  chain = load_qa_chain(OpenAI(), chain_type="stuff")
40
 
41
+ def interactive_search(query):
42
+ docs = docsearch.similarity_search(query)
43
+
44
+ result = chain.run(input_documents=docs, question=query)
45
+
46
+ return result
47
+
48
+ iface = gr.Interface(interactive_search,
49
+ inputs="text",
50
+ outputs="text",
51
+ title="Interactive Search",
52
+ description="Enter a query.")
53
  iface.launch()