Spaces:
Runtime error
Runtime error
fix: add the chatbot definition and the vote function
Browse files
app.py
CHANGED
|
@@ -25,6 +25,12 @@ client = InferenceClient(
|
|
| 25 |
headers={"Authorization": f"Bearer {HF_TOKEN}"},
|
| 26 |
)
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
def format_prompt(message, history, system_prompt):
|
| 29 |
prompt = ""
|
| 30 |
if system_prompt:
|
|
@@ -117,8 +123,10 @@ CSS = """
|
|
| 117 |
p {direction: rtl; white-space: pre-line;}
|
| 118 |
"""
|
| 119 |
|
|
|
|
| 120 |
chat_interface = gr.ChatInterface(
|
| 121 |
generate,
|
|
|
|
| 122 |
examples=EXAMPLES,
|
| 123 |
additional_inputs=additional_inputs
|
| 124 |
)
|
|
|
|
| 25 |
headers={"Authorization": f"Bearer {HF_TOKEN}"},
|
| 26 |
)
|
| 27 |
|
| 28 |
+
def vote(data: gr.LikeData):
|
| 29 |
+
if data.liked:
|
| 30 |
+
print("You upvoted this response: " + data.value)
|
| 31 |
+
else:
|
| 32 |
+
print("You downvoted this response: " + data.value)
|
| 33 |
+
|
| 34 |
def format_prompt(message, history, system_prompt):
|
| 35 |
prompt = ""
|
| 36 |
if system_prompt:
|
|
|
|
| 123 |
p {direction: rtl; white-space: pre-line;}
|
| 124 |
"""
|
| 125 |
|
| 126 |
+
chatbot = gr.Chatbot(bubble_full_width = False)
|
| 127 |
chat_interface = gr.ChatInterface(
|
| 128 |
generate,
|
| 129 |
+
chatbot=chatbot,
|
| 130 |
examples=EXAMPLES,
|
| 131 |
additional_inputs=additional_inputs
|
| 132 |
)
|