Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,7 +18,7 @@ import gradio as gr
|
|
| 18 |
llm = ChatOpenAI(model_name="gpt-3.5-turbo", openai_api_key="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")
|
| 19 |
|
| 20 |
# Initialize global variable for conversation memory
|
| 21 |
-
buffer_memory = ConversationBufferWindowMemory(k=
|
| 22 |
#buffer_memory = ConversationBufferWindowMemory(k=3)
|
| 23 |
|
| 24 |
conversation = ConversationChain(
|
|
@@ -29,9 +29,7 @@ conversation = ConversationChain(
|
|
| 29 |
|
| 30 |
context = """
|
| 31 |
You act as a chatbot to interact with users on their questions about traditional chinese medicine (TCM). \
|
| 32 |
-
Welcome the user in a friendly way
|
| 33 |
-
It is important to note that a chatbot is not a substitute for medical advice \
|
| 34 |
-
from a qualified healthcare professional. \
|
| 35 |
You respond in a short, very friendly style. \
|
| 36 |
For each text, mark NER tags. \
|
| 37 |
Tag categories: location, product. \
|
|
@@ -102,7 +100,7 @@ iface = gr.Interface(
|
|
| 102 |
fn=lambda query: conversation.run(prompt_template.format(context=context, query=query)),
|
| 103 |
inputs=gr.Textbox(),
|
| 104 |
outputs=gr.Textbox(),
|
| 105 |
-
live=
|
| 106 |
)
|
| 107 |
|
| 108 |
# Launch Gradio Interface
|
|
|
|
| 18 |
llm = ChatOpenAI(model_name="gpt-3.5-turbo", openai_api_key="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")
|
| 19 |
|
| 20 |
# Initialize global variable for conversation memory
|
| 21 |
+
buffer_memory = ConversationBufferWindowMemory(k=3)
|
| 22 |
#buffer_memory = ConversationBufferWindowMemory(k=3)
|
| 23 |
|
| 24 |
conversation = ConversationChain(
|
|
|
|
| 29 |
|
| 30 |
context = """
|
| 31 |
You act as a chatbot to interact with users on their questions about traditional chinese medicine (TCM). \
|
| 32 |
+
Welcome the user in a friendly way. \
|
|
|
|
|
|
|
| 33 |
You respond in a short, very friendly style. \
|
| 34 |
For each text, mark NER tags. \
|
| 35 |
Tag categories: location, product. \
|
|
|
|
| 100 |
fn=lambda query: conversation.run(prompt_template.format(context=context, query=query)),
|
| 101 |
inputs=gr.Textbox(),
|
| 102 |
outputs=gr.Textbox(),
|
| 103 |
+
live=True,
|
| 104 |
)
|
| 105 |
|
| 106 |
# Launch Gradio Interface
|