freddyaboulton HF Staff commited on
Commit
3c11088
·
verified ·
1 Parent(s): 98dbeff

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. requirements.txt +2 -2
  2. run.ipynb +1 -1
  3. run.py +7 -1
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
- gradio-client @ git+https://github.com/gradio-app/gradio@a1f2649586752a013fb4d36b83d5fea2e137bb81#subdirectory=client/python
2
- https://gradio-pypi-previews.s3.amazonaws.com/a1f2649586752a013fb4d36b83d5fea2e137bb81/gradio-5.9.1-py3-none-any.whl
 
1
+ gradio-client @ git+https://github.com/gradio-app/gradio@5ce28324971e974ae24dc9a229b2160793140fb2#subdirectory=client/python
2
+ https://gradio-pypi-previews.s3.amazonaws.com/5ce28324971e974ae24dc9a229b2160793140fb2/gradio-5.9.1-py3-none-any.whl
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\", flagging_mode=\"manual\", flagging_options=[\"Like\", \"Spam\", \"Inappropriate\", \"Other\"])\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: 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(\n", " slow_echo,\n", " type=\"messages\",\n", " flagging_mode=\"manual\",\n", " flagging_options=[\"Like\", \"Spam\", \"Inappropriate\", \"Other\"], \n", " save_history=True,\n", ")\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py CHANGED
@@ -6,7 +6,13 @@ 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", flagging_mode="manual", flagging_options=["Like", "Spam", "Inappropriate", "Other"])
 
 
 
 
 
 
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(
10
+ slow_echo,
11
+ type="messages",
12
+ flagging_mode="manual",
13
+ flagging_options=["Like", "Spam", "Inappropriate", "Other"],
14
+ save_history=True,
15
+ )
16
 
17
  if __name__ == "__main__":
18
  demo.launch()