Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -67,6 +67,9 @@ def wrap_text_preserve_newlines(text, width=200): # 110
|
|
67 |
|
68 |
def process_llm_response(llm_response):
|
69 |
ans = wrap_text_preserve_newlines(llm_response['result'])
|
|
|
|
|
|
|
70 |
sources_used = ' \n'.join([str(source.metadata['source'].split('/')[-1][:-4]) for source in llm_response['source_documents']])
|
71 |
ans = ans + '\n\nSources: \n' + sources_used
|
72 |
return ans
|
@@ -84,8 +87,15 @@ def predict(message, history):
|
|
84 |
output = str(llm_ans(message))
|
85 |
return output
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
demo = gr.ChatInterface(predict,
|
88 |
-
title = f'SAI Speaks'
|
|
|
89 |
|
90 |
if __name__ == "__main__":
|
91 |
demo.launch()
|
|
|
67 |
|
68 |
def process_llm_response(llm_response):
|
69 |
ans = wrap_text_preserve_newlines(llm_response['result'])
|
70 |
+
print(llm_response)
|
71 |
+
if "I don't know." in llm_response['result']:
|
72 |
+
return ans
|
73 |
sources_used = ' \n'.join([str(source.metadata['source'].split('/')[-1][:-4]) for source in llm_response['source_documents']])
|
74 |
ans = ans + '\n\nSources: \n' + sources_used
|
75 |
return ans
|
|
|
87 |
output = str(llm_ans(message))
|
88 |
return output
|
89 |
|
90 |
+
contribution_docstring = """
|
91 |
+
## An offering of love and gratitude by the II MSc Data Science and Computing Batch of 2023-24.
|
92 |
+
### Work done as part of the Deep Learning and Natural Language Processing Lab.
|
93 |
+
### Guided by Prakash PVSS
|
94 |
+
"""
|
95 |
+
|
96 |
demo = gr.ChatInterface(predict,
|
97 |
+
title = f'SAI Speaks',
|
98 |
+
description = contribution_docstring )
|
99 |
|
100 |
if __name__ == "__main__":
|
101 |
demo.launch()
|