freddyaboulton HF Staff commited on
Commit
c08ac3d
·
verified ·
1 Parent(s): 12c2c65

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. cached_testcase.py +2 -3
  2. requirements.txt +2 -2
  3. run.ipynb +1 -1
  4. run.py +2 -3
cached_testcase.py CHANGED
@@ -1,8 +1,7 @@
1
- from pathlib import Path
2
  import gradio as gr
3
 
4
- image = str(Path(__file__).parent / "files" / "avatar.png")
5
- audio = str(Path(__file__).parent / "files" / "cantina.wav")
6
 
7
  def echo(message, history):
8
  return f"You wrote: {message['text']} and uploaded {len(message['files'])} files."
 
 
1
  import gradio as gr
2
 
3
+ image = gr.get_image("avatar.png")
4
+ audio = gr.get_audio("cantina.wav")
5
 
6
  def echo(message, history):
7
  return f"You wrote: {message['text']} and uploaded {len(message['files'])} files."
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
- gradio-client @ git+https://github.com/gradio-app/gradio@45c7d6cc69003d7edf4b610f43efa3f37381d51c#subdirectory=client/python
2
- https://gradio-pypi-previews.s3.amazonaws.com/45c7d6cc69003d7edf4b610f43efa3f37381d51c/gradio-5.49.1-py3-none-any.whl
 
1
+ gradio-client @ git+https://github.com/gradio-app/gradio@6b5df4a691cb69b9f2cb1f179499a058389b2b3c#subdirectory=client/python
2
+ https://gradio-pypi-previews.s3.amazonaws.com/6b5df4a691cb69b9f2cb1f179499a058389b2b3c/gradio-5.49.1-py3-none-any.whl
run.ipynb CHANGED
@@ -1 +1 @@
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"]}, {"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}
 
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"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "image = gr.get_image(\"avatar.png\")\n", "audio = gr.get_audio(\"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}
run.py CHANGED
@@ -1,8 +1,7 @@
1
- from pathlib import Path
2
  import gradio as gr
3
 
4
- image = str(Path(__file__).parent / "files" / "avatar.png")
5
- audio = str(Path(__file__).parent / "files" / "cantina.wav")
6
 
7
  def echo(message, history):
8
  return f"You wrote: {message['text']} and uploaded {len(message['files'])} files."
 
 
1
  import gradio as gr
2
 
3
+ image = gr.get_image("avatar.png")
4
+ audio = gr.get_audio("cantina.wav")
5
 
6
  def echo(message, history):
7
  return f"You wrote: {message['text']} and uploaded {len(message['files'])} files."