lauraparra28 commited on
Commit
dace6eb
·
verified ·
1 Parent(s): e4bc260

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -1,19 +1,19 @@
1
- import gradio as gr
2
- import functions as fn
3
- import json
4
-
5
- data = fn.load_embeddings()
6
- num_documents = data['num_documents']
7
- num_segment_contents = data['num_segment_contents']
8
-
9
- with open("gradio.json", encoding='utf-8') as f:
10
- config = json.load(f)
11
- config['description'] = config['description'].format(num_documents=num_documents, num_segment_contents=num_segment_contents)
12
-
13
- def on_submit(query, history):
14
- response = fn.rag_response(query, data=data, detailed_response=False)
15
- return gr.HTML(response.replace("\n", "<br>"))
16
-
17
- demo = gr.ChatInterface(fn=on_submit, **config)
18
-
19
  demo.launch()
 
1
+ import gradio as gr
2
+ import functions as fn
3
+ import json
4
+
5
+ data = fn.load_embeddings()
6
+ num_documents = data['num_documents']
7
+ num_segment_contents = data['num_segment_contents']
8
+
9
+ with open("gradio.json", encoding='utf-8') as f:
10
+ config = json.load(f)
11
+ config['description'] = config['description'].format(num_documents=num_documents, num_segment_contents=num_segment_contents)
12
+
13
+ def on_submit(query, history):
14
+ response = fn.rag_response(query, data=data, detailed_response=False)
15
+ return gr.HTML(response.replace("\n", "<br>"))
16
+
17
+ demo = gr.ChatInterface(fn=on_submit, cache_examples= False, **config)
18
+
19
  demo.launch()