Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -70,20 +70,21 @@ def context_gpt_response(question):
|
|
| 70 |
context = ''
|
| 71 |
for match in match_list:
|
| 72 |
context += str(match[0])
|
| 73 |
-
|
| 74 |
# Generate an answer
|
| 75 |
response = openai.Completion.create(
|
| 76 |
engine="text-davinci-003",
|
| 77 |
-
prompt=
|
| 78 |
temperature=0.7,
|
| 79 |
max_tokens=150,
|
| 80 |
)
|
| 81 |
|
|
|
|
| 82 |
# Return the answer
|
| 83 |
return response['choices'][0]['text']
|
| 84 |
|
| 85 |
import gradio as gr
|
| 86 |
|
| 87 |
-
iface = gr.Interface(fn=context_gpt_response, inputs="text", outputs="text")
|
| 88 |
iface.launch()
|
| 89 |
|
|
|
|
| 70 |
context = ''
|
| 71 |
for match in match_list:
|
| 72 |
context += str(match[0])
|
| 73 |
+
prep = f"This is an OpenAI model tuned to answer questions specific to the Qualia Research institute, a research institute that focuses on the mathematics of consciousness. Here is some question-specific context, and then the Qualia Quesiton to answer: {context}. Q: {question} A: "
|
| 74 |
# Generate an answer
|
| 75 |
response = openai.Completion.create(
|
| 76 |
engine="text-davinci-003",
|
| 77 |
+
prompt=prep,
|
| 78 |
temperature=0.7,
|
| 79 |
max_tokens=150,
|
| 80 |
)
|
| 81 |
|
| 82 |
+
|
| 83 |
# Return the answer
|
| 84 |
return response['choices'][0]['text']
|
| 85 |
|
| 86 |
import gradio as gr
|
| 87 |
|
| 88 |
+
iface = gr.Interface(fn=context_gpt_response, inputs="text", outputs="text",title="Qualia Research Institute GPTbot", description="Ask any question and get QRI specific answers!")
|
| 89 |
iface.launch()
|
| 90 |
|