Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,35 +7,35 @@ import logging
|
|
7 |
logger = logging.getLogger(__name__)
|
8 |
|
9 |
|
10 |
-
logger.info('Instantiating vectordb')
|
11 |
-
vectordb = get_db(
|
12 |
-
chunk_size=1000,
|
13 |
-
chunk_overlap=200,
|
14 |
-
model_name = 'intfloat/multilingual-e5-large-instruct',
|
15 |
-
)
|
16 |
-
|
17 |
|
18 |
-
logger.info('Instantiating chain')
|
19 |
-
chain = get_chain(
|
20 |
-
vectordb,
|
21 |
-
repo_id="HuggingFaceH4/zephyr-7b-beta",
|
22 |
-
task="text-generation",
|
23 |
-
max_new_tokens=512,
|
24 |
-
top_k=30,
|
25 |
-
temperature=0.1,
|
26 |
-
repetition_penalty=1.03,
|
27 |
-
search_type="mmr",
|
28 |
-
k=3,
|
29 |
-
fetch_k=5,
|
30 |
-
template="""Use the following sentences of context to answer the question at the end.
|
31 |
-
If you don't know the answer, that is if the answer is not in the context, then just say that you don't know, don't try to make up an answer.
|
32 |
-
Always say "Thanks for asking!" at the end of the answer.
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
def respond(
|
41 |
question,
|
@@ -46,12 +46,10 @@ def respond(
|
|
46 |
top_p,
|
47 |
):
|
48 |
logger.info(f'respond called by Gradio ChatInterface with question={question}')
|
49 |
-
return chain.invoke({'question': question})
|
|
|
50 |
|
51 |
|
52 |
-
"""
|
53 |
-
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
54 |
-
"""
|
55 |
demo = gr.ChatInterface(
|
56 |
respond,
|
57 |
additional_inputs=[
|
|
|
7 |
logger = logging.getLogger(__name__)
|
8 |
|
9 |
|
10 |
+
#logger.info('Instantiating vectordb')
|
11 |
+
#vectordb = get_db(
|
12 |
+
# chunk_size=1000,
|
13 |
+
# chunk_overlap=200,
|
14 |
+
# model_name = 'intfloat/multilingual-e5-large-instruct',
|
15 |
+
#)
|
|
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
+
#logger.info('Instantiating chain')
|
19 |
+
#chain = get_chain(
|
20 |
+
# vectordb,
|
21 |
+
# repo_id="HuggingFaceH4/zephyr-7b-beta",
|
22 |
+
# task="text-generation",
|
23 |
+
# max_new_tokens=512,
|
24 |
+
# top_k=30,
|
25 |
+
# temperature=0.1,
|
26 |
+
# repetition_penalty=1.03,
|
27 |
+
# search_type="mmr",
|
28 |
+
# k=3,
|
29 |
+
# fetch_k=5,
|
30 |
+
# template="""Use the following sentences of context to answer the question at the end.
|
31 |
+
#If you don't know the answer, that is if the answer is not in the context, then just say that you don't know, don't try to make up an answer.
|
32 |
+
#Always say "Thanks for asking!" at the end of the answer.
|
33 |
+
#
|
34 |
+
#{context}
|
35 |
+
#
|
36 |
+
#Question: {question}
|
37 |
+
#Helpful Answer:"""
|
38 |
+
#)
|
39 |
|
40 |
def respond(
|
41 |
question,
|
|
|
46 |
top_p,
|
47 |
):
|
48 |
logger.info(f'respond called by Gradio ChatInterface with question={question}')
|
49 |
+
#return chain.invoke({'question': question})
|
50 |
+
return "hello!"
|
51 |
|
52 |
|
|
|
|
|
|
|
53 |
demo = gr.ChatInterface(
|
54 |
respond,
|
55 |
additional_inputs=[
|