Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -79,9 +79,11 @@ For each text, mark NER tags. \
|
|
| 79 |
Tag categories: location, product. \
|
| 80 |
Text: I want to buy/get [Po Chai Pills](product). \
|
| 81 |
If a user wants to buy/get a product, suggest that \
|
| 82 |
-
he/she can consider buying/getting from
|
|
|
|
| 83 |
For example, if a user wants to buy Po Chai Pills, suggest \
|
| 84 |
-
he/she can consider buying/getting from
|
|
|
|
| 85 |
Examples of product names:
|
| 86 |
Ointment/Hong You/Feng You/Fengyou
|
| 87 |
Liquorice/Gan cao/Gancao
|
|
@@ -96,23 +98,11 @@ prompt_template = PromptTemplate.from_template('''system role :{context} \
|
|
| 96 |
''')
|
| 97 |
|
| 98 |
# Define Gradio Interface
|
| 99 |
-
# iface = gr.Interface(
|
| 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 |
-
# Create a function to handle the Gradio Interface
|
| 107 |
-
def chat_interface(query, chat_history=[]):
|
| 108 |
-
response, chat_history = conversation.run(prompt_template.format(context=context, query=query), chat_history)
|
| 109 |
-
return response, chat_history + [query]
|
| 110 |
-
|
| 111 |
-
# Create the Gradio Interface
|
| 112 |
iface = gr.Interface(
|
| 113 |
-
fn=
|
| 114 |
inputs=gr.Textbox(),
|
| 115 |
outputs=gr.Textbox(),
|
|
|
|
| 116 |
)
|
| 117 |
|
| 118 |
# Launch Gradio Interface
|
|
|
|
| 79 |
Tag categories: location, product. \
|
| 80 |
Text: I want to buy/get [Po Chai Pills](product). \
|
| 81 |
If a user wants to buy/get a product, suggest that \
|
| 82 |
+
he/she can consider buying/getting from \
|
| 83 |
+
<a href="https://www.amazon.sg/s?k=product+name" target="_blank">https://www.amazon.sg/s?k=product+name</a> \
|
| 84 |
For example, if a user wants to buy Po Chai Pills, suggest \
|
| 85 |
+
he/she can consider buying/getting from \
|
| 86 |
+
<a href="https://www.amazon.sg/s?k=po+chai+pills" target="_blank">https://www.amazon.sg/s?k=po+chai+pills</a> \
|
| 87 |
Examples of product names:
|
| 88 |
Ointment/Hong You/Feng You/Fengyou
|
| 89 |
Liquorice/Gan cao/Gancao
|
|
|
|
| 98 |
''')
|
| 99 |
|
| 100 |
# Define Gradio Interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
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=True,
|
| 106 |
)
|
| 107 |
|
| 108 |
# Launch Gradio Interface
|