Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 5.
|
| 8 |
-
app_file:
|
| 9 |
pinned: false
|
|
|
|
| 10 |
---
|
| 11 |
-
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
+
|
| 2 |
---
|
| 3 |
+
title: chatbot_feedback
|
| 4 |
+
emoji: 🔥
|
| 5 |
+
colorFrom: indigo
|
| 6 |
+
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
+
sdk_version: 5.48.0
|
| 9 |
+
app_file: run.py
|
| 10 |
pinned: false
|
| 11 |
+
hf_oauth: true
|
| 12 |
---
|
|
|
|
|
|
run.ipynb
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: chatbot_feedback"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "def test_liked_loading():\n", " test_history = [\n", " {\"role\": \"user\", \"content\": \"test user message\"},\n", " {\"role\": \"assistant\", \"content\": \"test assistant message\"}\n", " ]\n", " # Set feedback_value to [\"Like\"] for the assistant message\n", " return gr.update(value=test_history, feedback_value=[\"Like\"])\n", "\n", "with gr.Blocks() as demo:\n", " chatbot = gr.Chatbot(\n", " type=\"messages\",\n", " resizable=True,\n", " min_height=500,\n", " layout=\"bubble\",\n", " )\n", " chatbot.like(\n", " lambda: None,\n", " inputs=[],\n", " outputs=None,\n", " )\n", " test_btn = gr.Button(\"Test Liked Loading\")\n", " test_btn.click(test_liked_loading, outputs=[chatbot])\n", "\n", "demo.launch(debug=True)\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def test_liked_loading():
|
| 4 |
+
test_history = [
|
| 5 |
+
{"role": "user", "content": "test user message"},
|
| 6 |
+
{"role": "assistant", "content": "test assistant message"}
|
| 7 |
+
]
|
| 8 |
+
# Set feedback_value to ["Like"] for the assistant message
|
| 9 |
+
return gr.update(value=test_history, feedback_value=["Like"])
|
| 10 |
+
|
| 11 |
+
with gr.Blocks() as demo:
|
| 12 |
+
chatbot = gr.Chatbot(
|
| 13 |
+
type="messages",
|
| 14 |
+
resizable=True,
|
| 15 |
+
min_height=500,
|
| 16 |
+
layout="bubble",
|
| 17 |
+
)
|
| 18 |
+
chatbot.like(
|
| 19 |
+
lambda: None,
|
| 20 |
+
inputs=[],
|
| 21 |
+
outputs=None,
|
| 22 |
+
)
|
| 23 |
+
test_btn = gr.Button("Test Liked Loading")
|
| 24 |
+
test_btn.click(test_liked_loading, outputs=[chatbot])
|
| 25 |
+
|
| 26 |
+
demo.launch(debug=True)
|