Commit 1: Add 50 file(s)
Browse files
demos/chatinterface_streaming_echo/run.ipynb
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: chatinterface_streaming_echo"]}, {"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 time\n", "import gradio as gr\n", "\n", "def slow_echo(message, history):\n", " for i in range(len(message)):\n", " time.sleep(0.05)\n", " yield \"You typed: \" + message[: i + 1]\n", "\n", "demo = gr.ChatInterface(slow_echo, type=\"messages\"
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: chatinterface_streaming_echo"]}, {"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 time\n", "import gradio as gr\n", "\n", "def slow_echo(message, history):\n", " for i in range(len(message)):\n", " time.sleep(0.05)\n", " yield \"You typed: \" + message[: i + 1]\n", "\n", "demo = gr.ChatInterface(slow_echo, type=\"messages\")\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
demos/chatinterface_streaming_echo/run.py
CHANGED
@@ -6,7 +6,7 @@ def slow_echo(message, history):
|
|
6 |
time.sleep(0.05)
|
7 |
yield "You typed: " + message[: i + 1]
|
8 |
|
9 |
-
demo = gr.ChatInterface(slow_echo, type="messages"
|
10 |
|
11 |
if __name__ == "__main__":
|
12 |
demo.launch()
|
|
|
6 |
time.sleep(0.05)
|
7 |
yield "You typed: " + message[: i + 1]
|
8 |
|
9 |
+
demo = gr.ChatInterface(slow_echo, type="messages")
|
10 |
|
11 |
if __name__ == "__main__":
|
12 |
demo.launch()
|