Upload folder using huggingface_hub
Browse files- requirements.txt +2 -2
- run.ipynb +1 -1
- run.py +1 -2
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
gradio-client @ git+https://github.com/gradio-app/gradio@
|
2 |
-
https://gradio-builds.s3.amazonaws.com/
|
|
|
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: image_component_events"]}, {"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 gradio as gr\n", "\n", "def test_select_is_defined(n, evt: gr.SelectData):\n", " assert isinstance(evt.index, list)\n", " assert isinstance(evt.index[0], int)\n", " return n + 1\n", "\n", "
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: image_component_events"]}, {"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 gradio as gr\n", "\n", "def test_select_is_defined(n, evt: gr.SelectData):\n", " assert isinstance(evt.index, list)\n", " assert isinstance(evt.index[0], int)\n", " return n + 1\n", "\n", "with gr.Blocks() as demo:\n", " with gr.Row():\n", " with gr.Column():\n", " input_img = gr.Image(type=\"filepath\", label=\"Input Image\", sources=[\"upload\", \"clipboard\"])\n", " with gr.Column():\n", " output_img = gr.Image(type=\"filepath\", label=\"Output Image\", sources=[\"upload\", \"clipboard\"])\n", " with gr.Column():\n", " num_change = gr.Number(label=\"# Change Events\", value=0)\n", " num_input = gr.Number(label=\"# Input Events\", value=0)\n", " num_load = gr.Number(label=\"# Upload Events\", value=0)\n", " num_change_o = gr.Number(label=\"# Change Events Output\", value=0)\n", " num_clear = gr.Number(label=\"# Clear Events\", value=0)\n", " num_select = gr.Number(label=\"# Select Events\", value=0)\n", "\n", " input_img.upload(lambda s, n: (s, n + 1), [input_img, num_load], [output_img, num_load])\n", " input_img.input(lambda n: n + 1, num_input, num_input)\n", " input_img.change(lambda n: n + 1, num_change, num_change)\n", " input_img.clear(lambda n: n + 1, num_clear, num_clear)\n", " output_img.change(lambda n: n + 1, num_change_o, num_change_o)\n", " output_img.select(test_select_is_defined, num_select, num_select)\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
CHANGED
@@ -5,7 +5,6 @@ def test_select_is_defined(n, evt: gr.SelectData):
|
|
5 |
assert isinstance(evt.index[0], int)
|
6 |
return n + 1
|
7 |
|
8 |
-
|
9 |
with gr.Blocks() as demo:
|
10 |
with gr.Row():
|
11 |
with gr.Column():
|
@@ -28,4 +27,4 @@ with gr.Blocks() as demo:
|
|
28 |
output_img.select(test_select_is_defined, num_select, num_select)
|
29 |
|
30 |
if __name__ == "__main__":
|
31 |
-
demo.launch()
|
|
|
5 |
assert isinstance(evt.index[0], int)
|
6 |
return n + 1
|
7 |
|
|
|
8 |
with gr.Blocks() as demo:
|
9 |
with gr.Row():
|
10 |
with gr.Column():
|
|
|
27 |
output_img.select(test_select_is_defined, num_select, num_select)
|
28 |
|
29 |
if __name__ == "__main__":
|
30 |
+
demo.launch()
|