Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import sys
|
|
| 5 |
import os
|
| 6 |
import datetime
|
| 7 |
|
| 8 |
-
os.environ["OPENAI_API_KEY"] = '
|
| 9 |
|
| 10 |
|
| 11 |
def get_index(index_file_path):
|
|
@@ -16,9 +16,9 @@ def get_index(index_file_path):
|
|
| 16 |
sys.exit()
|
| 17 |
|
| 18 |
|
| 19 |
-
def chatbot(input_text, mentioned_person='
|
| 20 |
index = get_index('index.json')
|
| 21 |
-
prompt = f"{mentioned_person}: {input_text}\n\n At the end of your answer
|
| 22 |
response = index.query(prompt, response_mode="compact")
|
| 23 |
|
| 24 |
|
|
@@ -35,13 +35,10 @@ def chatbot(input_text, mentioned_person='Mediation teacher John Haynes'):
|
|
| 35 |
return response.response
|
| 36 |
|
| 37 |
|
| 38 |
-
with open("docs/about/descript.txt", "r") as f:
|
| 39 |
-
description = f.read()
|
| 40 |
-
|
| 41 |
iface = gr.Interface(fn=chatbot,
|
| 42 |
inputs=gr.inputs.Textbox(lines=5, label="Enter your question"),
|
| 43 |
outputs=gr.outputs.Textbox(label="Chatbot Response"),
|
| 44 |
title="AI Chatbot trained on J. Haynes mediation material, v0.1",
|
| 45 |
-
description=
|
| 46 |
|
| 47 |
iface.launch(share=True)
|
|
|
|
| 5 |
import os
|
| 6 |
import datetime
|
| 7 |
|
| 8 |
+
os.environ["OPENAI_API_KEY"] = os.environ['APICode']
|
| 9 |
|
| 10 |
|
| 11 |
def get_index(index_file_path):
|
|
|
|
| 16 |
sys.exit()
|
| 17 |
|
| 18 |
|
| 19 |
+
def chatbot(input_text, mentioned_person='Mediator John Haynes'):
|
| 20 |
index = get_index('index.json')
|
| 21 |
+
prompt = f"You are {mentioned_person}: {input_text}\n\n At the end of your answer ask a provocative question."
|
| 22 |
response = index.query(prompt, response_mode="compact")
|
| 23 |
|
| 24 |
|
|
|
|
| 35 |
return response.response
|
| 36 |
|
| 37 |
|
|
|
|
|
|
|
|
|
|
| 38 |
iface = gr.Interface(fn=chatbot,
|
| 39 |
inputs=gr.inputs.Textbox(lines=5, label="Enter your question"),
|
| 40 |
outputs=gr.outputs.Textbox(label="Chatbot Response"),
|
| 41 |
title="AI Chatbot trained on J. Haynes mediation material, v0.1",
|
| 42 |
+
description="test")
|
| 43 |
|
| 44 |
iface.launch(share=True)
|