Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
emoji: 🔥
|
| 4 |
colorFrom: indigo
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 4.3.0
|
| 8 |
-
app_file:
|
| 9 |
pinned: false
|
|
|
|
| 10 |
---
|
| 11 |
-
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
+
|
| 2 |
---
|
| 3 |
+
title: upload_button_component_events_main
|
| 4 |
emoji: 🔥
|
| 5 |
colorFrom: indigo
|
| 6 |
+
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
sdk_version: 4.3.0
|
| 9 |
+
app_file: run.py
|
| 10 |
pinned: false
|
| 11 |
+
hf_oauth: true
|
| 12 |
---
|
|
|
|
|
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
https://gradio-builds.s3.amazonaws.com/2761b6d197acc1c6a2fd9534e7633b463bd3f1e0/gradio-4.3.0-py3-none-any.whl
|
run.ipynb
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: upload_button_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", "with gr.Blocks() as demo:\n", " \n", " with gr.Row():\n", " with gr.Column():\n", " upload_btn = gr.UploadButton(label=\"Upload Single File\", file_count=\"single\")\n", " with gr.Column():\n", " output_file_1 = gr.File(label=\"Upload Single File Output\", file_count=\"single\")\n", " num_load_btn_1 = gr.Number(label=\"# Load Upload Single File\", value=0)\n", " output_click_1 = gr.Number(label=\"# Click Upload Single File Output\", value=0)\n", " upload_btn.upload(lambda s,n: (s, n + 1), [upload_btn, num_load_btn_1], [output_file_1, num_load_btn_1])\n", " upload_btn.click(lambda n: (n + 1), output_click_1, [output_click_1])\n", " with gr.Row():\n", " with gr.Column():\n", " upload_btn_multiple = gr.UploadButton(label=\"Upload Multiple Files\", file_count=\"multiple\")\n", " with gr.Column():\n", " output_file_2 = gr.File(label=\"Upload Multiple Files Output\", file_count=\"multiple\")\n", " num_load_btn_2 = gr.Number(label=\"# Load Upload Multiple Files\", value=0)\n", " output_click_2 = gr.Number(label=\"# Click Upload Multiple Files Output\", value=0)\n", " upload_btn_multiple.upload(lambda s,n: (s, n + 1), [upload_btn_multiple, num_load_btn_2], [output_file_2, num_load_btn_2])\n", " upload_btn_multiple.click(lambda n: (n + 1), output_click_2, [output_click_2])\n", "\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
with gr.Blocks() as demo:
|
| 4 |
+
|
| 5 |
+
with gr.Row():
|
| 6 |
+
with gr.Column():
|
| 7 |
+
upload_btn = gr.UploadButton(label="Upload Single File", file_count="single")
|
| 8 |
+
with gr.Column():
|
| 9 |
+
output_file_1 = gr.File(label="Upload Single File Output", file_count="single")
|
| 10 |
+
num_load_btn_1 = gr.Number(label="# Load Upload Single File", value=0)
|
| 11 |
+
output_click_1 = gr.Number(label="# Click Upload Single File Output", value=0)
|
| 12 |
+
upload_btn.upload(lambda s,n: (s, n + 1), [upload_btn, num_load_btn_1], [output_file_1, num_load_btn_1])
|
| 13 |
+
upload_btn.click(lambda n: (n + 1), output_click_1, [output_click_1])
|
| 14 |
+
with gr.Row():
|
| 15 |
+
with gr.Column():
|
| 16 |
+
upload_btn_multiple = gr.UploadButton(label="Upload Multiple Files", file_count="multiple")
|
| 17 |
+
with gr.Column():
|
| 18 |
+
output_file_2 = gr.File(label="Upload Multiple Files Output", file_count="multiple")
|
| 19 |
+
num_load_btn_2 = gr.Number(label="# Load Upload Multiple Files", value=0)
|
| 20 |
+
output_click_2 = gr.Number(label="# Click Upload Multiple Files Output", value=0)
|
| 21 |
+
upload_btn_multiple.upload(lambda s,n: (s, n + 1), [upload_btn_multiple, num_load_btn_2], [output_file_2, num_load_btn_2])
|
| 22 |
+
upload_btn_multiple.click(lambda n: (n + 1), output_click_2, [output_click_2])
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
if __name__ == "__main__":
|
| 26 |
+
demo.launch()
|