Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds a run_examples_on_click parameter to gr.ChatInterface mirroring the the run_on_click parameter in gr.Examples #10109

Merged
merged 36 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
066256b
add param
abidlabs Dec 3, 2024
ab120ff
add changeset
gradio-pr-bot Dec 3, 2024
08332b0
add changeset
gradio-pr-bot Dec 3, 2024
943ddce
more changes
abidlabs Dec 3, 2024
22dc21a
Merge branch 'run-chi' of github.com:gradio-app/gradio into run-chi
abidlabs Dec 3, 2024
869e32c
add changeset
gradio-pr-bot Dec 3, 2024
0c6ea0e
slight refactor
abidlabs Dec 3, 2024
2895ef3
Merge branch 'run-chi' of github.com:gradio-app/gradio into run-chi
abidlabs Dec 3, 2024
78dbab5
Merge branch 'main' into run-chi
abidlabs Dec 4, 2024
78c1299
add changeset
gradio-pr-bot Dec 4, 2024
cf14b23
Merge branch 'main' into run-chi
abidlabs Dec 4, 2024
2e67352
Merge branch 'main' into run-chi
abidlabs Dec 5, 2024
dda58ee
fix
abidlabs Dec 5, 2024
4ec7afc
fixes
abidlabs Dec 5, 2024
3f04e53
tweak
abidlabs Dec 5, 2024
35964fa
clean
abidlabs Dec 5, 2024
7080732
clean
abidlabs Dec 5, 2024
a057af5
lint
abidlabs Dec 5, 2024
cd53881
upload
abidlabs Dec 6, 2024
9c56021
notebook
abidlabs Dec 6, 2024
f230026
Merge branch 'main' into run-chi
abidlabs Dec 6, 2024
a95803d
more testing
abidlabs Dec 6, 2024
fb823dd
changes
abidlabs Dec 6, 2024
64b9f9f
notebook
abidlabs Dec 6, 2024
3983758
add changeset
gradio-pr-bot Dec 6, 2024
e07efc9
notebooks
abidlabs Dec 6, 2024
5f2d004
Merge branch 'run-chi' of github.com:gradio-app/gradio into run-chi
abidlabs Dec 6, 2024
f7488a0
format
abidlabs Dec 6, 2024
7c8c250
format
abidlabs Dec 6, 2024
019cd35
fix undo
abidlabs Dec 6, 2024
c00cd99
changes
abidlabs Dec 6, 2024
7afd9a6
Merge branch 'main' into run-chi
abidlabs Dec 7, 2024
b26cc4c
changes
abidlabs Dec 7, 2024
e9643de
fix
abidlabs Dec 7, 2024
829d676
changes
abidlabs Dec 7, 2024
43acdc2
fix assert
abidlabs Dec 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/evil-hoops-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"gradio": minor
"website": minor
---

feat:adds a `run_examples_on_click` parameter to `gr.ChatInterface` mirroring the the `run_on_click` parameter in `gr.Examples`
1 change: 0 additions & 1 deletion demo/chatinterface_multimodal/run.ipynb

This file was deleted.

13 changes: 0 additions & 13 deletions demo/chatinterface_multimodal/run.py

This file was deleted.

19 changes: 19 additions & 0 deletions demo/test_chatinterface_multimodal_examples/cached_testcase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from pathlib import Path
import gradio as gr

image = str(Path(__file__).parent / "files" / "avatar.png")
audio = str(Path(__file__).parent / "files" / "cantina.wav")

def echo(message, history):
return f"You wrote: {message['text']} and uploaded {len(message['files'])} files."

demo = gr.ChatInterface(
fn=echo,
type="messages",
examples=[{"text": "hello"}, {"text": "hola", "files": [image]}, {"text": "merhaba", "files": [image, audio]}],
title="Echo Bot",
multimodal=True,
)

if __name__ == "__main__":
demo.launch()
1 change: 1 addition & 0 deletions demo/test_chatinterface_multimodal_examples/run.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: test_chatinterface_multimodal_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_multimodal_examples/cached_testcase.py\n", "os.mkdir('files')\n", "!wget -q -O files/avatar.png https://github.com/gradio-app/gradio/raw/main/demo/test_chatinterface_multimodal_examples/files/avatar.png\n", "!wget -q -O files/cantina.wav https://github.com/gradio-app/gradio/raw/main/demo/test_chatinterface_multimodal_examples/files/cantina.wav"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["from pathlib import Path\n", "import gradio as gr\n", "\n", "image = str(Path(__file__).parent / \"files\" / \"avatar.png\")\n", "audio = str(Path(__file__).parent / \"files\" / \"cantina.wav\")\n", "\n", "def echo(message, history):\n", " return f\"You wrote: {message['text']} and uploaded {len(message['files'])} files.\"\n", "\n", "demo = gr.ChatInterface(\n", " fn=echo,\n", " type=\"messages\",\n", " examples=[{\"text\": \"hello\"}, {\"text\": \"hola\", \"files\": [image]}, {\"text\": \"merhaba\", \"files\": [image, audio]}],\n", " title=\"Echo Bot\",\n", " multimodal=True,\n", ")\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
19 changes: 19 additions & 0 deletions demo/test_chatinterface_multimodal_examples/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from pathlib import Path
import gradio as gr

image = str(Path(__file__).parent / "files" / "avatar.png")
audio = str(Path(__file__).parent / "files" / "cantina.wav")

def echo(message, history):
return f"You wrote: {message['text']} and uploaded {len(message['files'])} files."

demo = gr.ChatInterface(
fn=echo,
type="messages",
examples=[{"text": "hello"}, {"text": "hola", "files": [image]}, {"text": "merhaba", "files": [image, audio]}],
title="Echo Bot",
multimodal=True,
)

if __name__ == "__main__":
demo.launch()
Loading
Loading