Halo
commited on
Commit
•
42a4407
1
Parent(s):
018c8a0
Update app
Browse files
app.py
CHANGED
@@ -137,10 +137,13 @@ def generate_answer(question, openAI_key, model_name):
|
|
137 |
"don't add any additional information. Make sure the answer is correct and don't output false content. "\
|
138 |
"If the text does not relate to the query, simply state 'Found Nothing'. Ignore outlier "\
|
139 |
"search results which has nothing to do with the question. Only answer what is asked. The "\
|
140 |
-
"answer should be short and concise.
|
141 |
|
142 |
prompt += f"Query: {question}\nAnswer:"
|
143 |
-
|
|
|
|
|
|
|
144 |
return answer
|
145 |
|
146 |
|
@@ -200,4 +203,4 @@ with gr.Blocks() as demo:
|
|
200 |
|
201 |
btn.click(question_answer, inputs=[url, file, question, openAI_key, model_name], outputs=[answer])
|
202 |
#openai.api_key = os.getenv('Your_Key_Here')
|
203 |
-
demo.launch()
|
|
|
137 |
"don't add any additional information. Make sure the answer is correct and don't output false content. "\
|
138 |
"If the text does not relate to the query, simply state 'Found Nothing'. Ignore outlier "\
|
139 |
"search results which has nothing to do with the question. Only answer what is asked. The "\
|
140 |
+
"answer should be short and concise. "
|
141 |
|
142 |
prompt += f"Query: {question}\nAnswer:"
|
143 |
+
if model_name.startswith('gpt'):
|
144 |
+
answer = generate_text(openAI_key, prompt, question, model)
|
145 |
+
else:
|
146 |
+
answer = generate_text(openAI_key, prompt, model)
|
147 |
return answer
|
148 |
|
149 |
|
|
|
203 |
|
204 |
btn.click(question_answer, inputs=[url, file, question, openAI_key, model_name], outputs=[answer])
|
205 |
#openai.api_key = os.getenv('Your_Key_Here')
|
206 |
+
demo.launch(share=True)
|