Spaces:
Sleeping
Sleeping
Commit ·
4b9192d
1
Parent(s): 37f663f
updated model
Browse files
app.py
CHANGED
|
@@ -126,20 +126,20 @@ def generate_answer(question):
|
|
| 126 |
"with the same name, create separate answers for each. Only include information found in the results and "\
|
| 127 |
"don't add any additional information. Make sure the answer is correct and don't output false content. "\
|
| 128 |
"If the text does not relate to the query, simply state 'Found Nothing'. Ignore outlier "\
|
| 129 |
-
"search results which has nothing to do with the question. Only answer what is asked.
|
| 130 |
-
"
|
| 131 |
|
| 132 |
prompt += f"Query: {question}\nAnswer:"
|
| 133 |
-
answer = generate_text(prompt,"
|
| 134 |
return answer
|
| 135 |
|
| 136 |
|
| 137 |
def question_answer(url, file, question):
|
| 138 |
if url.strip() == '' and file == None:
|
| 139 |
-
return '[ERROR]: Both URL and PDF is empty. Provide
|
| 140 |
|
| 141 |
if url.strip() != '' and file != None:
|
| 142 |
-
return '[ERROR]: Both URL and PDF is provided. Please provide only one (
|
| 143 |
|
| 144 |
if url.strip() != '':
|
| 145 |
glob_url = url
|
|
@@ -161,8 +161,8 @@ def question_answer(url, file, question):
|
|
| 161 |
|
| 162 |
recommender = SemanticSearch()
|
| 163 |
|
| 164 |
-
title = 'CauseWriter PDF'
|
| 165 |
-
description = """ PDF GPT allows you to chat with your PDF file using Universal Sentence Encoder and Open AI.
|
| 166 |
|
| 167 |
|
| 168 |
with gr.Blocks() as demo:
|
|
|
|
| 126 |
"with the same name, create separate answers for each. Only include information found in the results and "\
|
| 127 |
"don't add any additional information. Make sure the answer is correct and don't output false content. "\
|
| 128 |
"If the text does not relate to the query, simply state 'Found Nothing'. Ignore outlier "\
|
| 129 |
+
"search results which has nothing to do with the question. Only answer what is asked. "\
|
| 130 |
+
"Work creatively with the user to create content based on results. \n\nQuery: {question}\nAnswer: "
|
| 131 |
|
| 132 |
prompt += f"Query: {question}\nAnswer:"
|
| 133 |
+
answer = generate_text(prompt,"gpt-3.5-turbo-16k")
|
| 134 |
return answer
|
| 135 |
|
| 136 |
|
| 137 |
def question_answer(url, file, question):
|
| 138 |
if url.strip() == '' and file == None:
|
| 139 |
+
return '[ERROR]: Both URL and PDF is empty. Provide at least one.'
|
| 140 |
|
| 141 |
if url.strip() != '' and file != None:
|
| 142 |
+
return '[ERROR]: Both URL and PDF is provided. Please provide only one (either URL or PDF).'
|
| 143 |
|
| 144 |
if url.strip() != '':
|
| 145 |
glob_url = url
|
|
|
|
| 161 |
|
| 162 |
recommender = SemanticSearch()
|
| 163 |
|
| 164 |
+
title = 'CauseWriter.ai PDF'
|
| 165 |
+
description = """ PDF GPT allows you to chat with your PDF file using Universal Sentence Encoder and Open AI. The response will probably cite the page number in square brackets([]) where the information is located, but who knows this is an AI."""
|
| 166 |
|
| 167 |
|
| 168 |
with gr.Blocks() as demo:
|