aliabd HF Staff commited on
Commit
329d163
·
verified ·
1 Parent(s): 28b4cb3

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. messages_testcase.py +1 -2
  2. requirements.txt +2 -2
  3. run.ipynb +1 -1
  4. run.py +1 -3
messages_testcase.py CHANGED
@@ -10,8 +10,7 @@ def slow_echo(message, history):
10
  time.sleep(0.05)
11
  yield f"Run {runs} - You typed: " + message[: i + 1]
12
 
13
-
14
- demo = gr.ChatInterface(slow_echo, type="messages").queue()
15
 
16
  if __name__ == "__main__":
17
  demo.launch()
 
10
  time.sleep(0.05)
11
  yield f"Run {runs} - You typed: " + message[: i + 1]
12
 
13
+ demo = gr.ChatInterface(slow_echo, type="messages")
 
14
 
15
  if __name__ == "__main__":
16
  demo.launch()
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
- gradio-client @ git+https://github.com/gradio-app/gradio@de997e67c9a7feb9e2eccebf92969366dbd67eba#subdirectory=client/python
2
- https://gradio-builds.s3.amazonaws.com/de997e67c9a7feb9e2eccebf92969366dbd67eba/gradio-4.39.0-py3-none-any.whl
 
1
+ gradio-client @ git+https://github.com/gradio-app/gradio@9b42ba8f1006c05d60a62450d3036ce0d6784f86#subdirectory=client/python
2
+ https://gradio-builds.s3.amazonaws.com/9b42ba8f1006c05d60a62450d3036ce0d6784f86/gradio-4.39.0-py3-none-any.whl
run.ipynb CHANGED
@@ -1 +1 @@
1
- {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: test_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": ["# Downloading files from the demo repo\n", "import os\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/test_chatinterface_streaming_echo/messages_testcase.py"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "runs = 0\n", "\n", "\n", "def slow_echo(message, history):\n", " global runs # i didn't want to add state or anything to this demo\n", " runs = runs + 1\n", " for i in range(len(message)):\n", " yield f\"Run {runs} - You typed: \" + message[: i + 1]\n", "\n", "\n", "demo = gr.ChatInterface(slow_echo).queue()\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
 
1
+ {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: test_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": ["# Downloading files from the demo repo\n", "import os\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/test_chatinterface_streaming_echo/messages_testcase.py"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "runs = 0\n", "\n", "def slow_echo(message, history):\n", " global runs # i didn't want to add state or anything to this demo\n", " runs = runs + 1\n", " for i in range(len(message)):\n", " yield f\"Run {runs} - You typed: \" + message[: i + 1]\n", "\n", "demo = gr.ChatInterface(slow_echo)\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py CHANGED
@@ -2,15 +2,13 @@ import gradio as gr
2
 
3
  runs = 0
4
 
5
-
6
  def slow_echo(message, history):
7
  global runs # i didn't want to add state or anything to this demo
8
  runs = runs + 1
9
  for i in range(len(message)):
10
  yield f"Run {runs} - You typed: " + message[: i + 1]
11
 
12
-
13
- demo = gr.ChatInterface(slow_echo).queue()
14
 
15
  if __name__ == "__main__":
16
  demo.launch()
 
2
 
3
  runs = 0
4
 
 
5
  def slow_echo(message, history):
6
  global runs # i didn't want to add state or anything to this demo
7
  runs = runs + 1
8
  for i in range(len(message)):
9
  yield f"Run {runs} - You typed: " + message[: i + 1]
10
 
11
+ demo = gr.ChatInterface(slow_echo)
 
12
 
13
  if __name__ == "__main__":
14
  demo.launch()