freddyaboulton HF Staff commited on
Commit
fccd732
·
verified ·
1 Parent(s): 35d0b85

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -5,7 +5,7 @@ emoji: 🔥
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
- sdk_version: 5.6.0
9
  app_file: run.py
10
  pinned: false
11
  hf_oauth: true
 
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
+ sdk_version: 5.7.0
9
  app_file: run.py
10
  pinned: false
11
  hf_oauth: true
eager_caching_examples_testcase.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def generate(
4
+ message: str,
5
+ chat_history: list[dict],
6
+ ):
7
+
8
+ output = ""
9
+ for character in message:
10
+ output += character
11
+ yield output
12
+
13
+
14
+ demo = gr.ChatInterface(
15
+ fn=generate,
16
+ examples=[
17
+ ["Hey"],
18
+ ["Can you explain briefly to me what is the Python programming language?"],
19
+ ],
20
+ cache_examples=True,
21
+ cache_mode="eager",
22
+ type="messages",
23
+ )
24
+
25
+
26
+ if __name__ == "__main__":
27
+ demo.launch()
lazy_caching_examples_testcase.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def generate(
4
+ message: str,
5
+ chat_history: list[dict],
6
+ ):
7
+
8
+ output = ""
9
+ for character in message:
10
+ output += character
11
+ yield output
12
+
13
+
14
+ demo = gr.ChatInterface(
15
+ fn=generate,
16
+ examples=[
17
+ ["Hey"],
18
+ ["Can you explain briefly to me what is the Python programming language?"],
19
+ ],
20
+ cache_examples=True,
21
+ cache_mode="lazy",
22
+ type="messages",
23
+ )
24
+
25
+
26
+ if __name__ == "__main__":
27
+ demo.launch()
multimodal_messages_examples_testcase.py CHANGED
@@ -24,4 +24,4 @@ demo = gr.ChatInterface(
24
 
25
 
26
  if __name__ == "__main__":
27
- demo.launch()
 
24
 
25
 
26
  if __name__ == "__main__":
27
+ demo.launch()
multimodal_tuples_examples_testcase.py CHANGED
@@ -24,4 +24,4 @@ demo = gr.ChatInterface(
24
 
25
 
26
  if __name__ == "__main__":
27
- demo.launch()
 
24
 
25
 
26
  if __name__ == "__main__":
27
+ demo.launch()
run.ipynb CHANGED
@@ -1 +1 @@
1
- {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: test_chatinterface_examples"]}, {"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_examples/multimodal_messages_examples_testcase.py\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/test_chatinterface_examples/multimodal_tuples_examples_testcase.py\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/test_chatinterface_examples/tuples_examples_testcase.py"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "def generate(\n", " message: str,\n", " chat_history: list[dict],\n", "):\n", "\n", " output = \"\"\n", " for character in message:\n", " output += character\n", " yield output\n", "\n", "\n", "demo = gr.ChatInterface(\n", " fn=generate,\n", " examples=[\n", " [\"Hey\"],\n", " [\"Can you explain briefly to me what is the Python programming language?\"],\n", " ],\n", " cache_examples=False,\n", " type=\"messages\",\n", ")\n", "\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
 
1
+ {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: test_chatinterface_examples"]}, {"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_examples/eager_caching_examples_testcase.py\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/test_chatinterface_examples/lazy_caching_examples_testcase.py\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/test_chatinterface_examples/multimodal_messages_examples_testcase.py\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/test_chatinterface_examples/multimodal_tuples_examples_testcase.py\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/test_chatinterface_examples/tuples_examples_testcase.py"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "def generate(\n", " message: str,\n", " chat_history: list[dict],\n", "):\n", "\n", " output = \"\"\n", " for character in message:\n", " output += character\n", " yield output\n", "\n", "\n", "demo = gr.ChatInterface(\n", " fn=generate,\n", " examples=[\n", " [\"Hey\"],\n", " [\"Can you explain briefly to me what is the Python programming language?\"],\n", " ],\n", " cache_examples=False,\n", " type=\"messages\",\n", ")\n", "\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py CHANGED
@@ -23,4 +23,4 @@ demo = gr.ChatInterface(
23
 
24
 
25
  if __name__ == "__main__":
26
- demo.launch()
 
23
 
24
 
25
  if __name__ == "__main__":
26
+ demo.launch()
tuples_examples_testcase.py CHANGED
@@ -24,4 +24,4 @@ demo = gr.ChatInterface(
24
 
25
 
26
  if __name__ == "__main__":
27
- demo.launch()
 
24
 
25
 
26
  if __name__ == "__main__":
27
+ demo.launch()