Spaces:
Running
Running
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:
|
| 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: pending_inputs
|
| 4 |
+
emoji: 🔥
|
| 5 |
colorFrom: indigo
|
| 6 |
+
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
+
sdk_version: 6.0.0
|
| 9 |
+
app_file: run.py
|
| 10 |
pinned: false
|
| 11 |
+
hf_oauth: true
|
| 12 |
---
|
|
|
|
|
|
run.ipynb
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: pending_inputs"]}, {"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", "\n", "with gr.Blocks() as demo:\n", " gr.Markdown(\"# Pending Input Components\")\n", " with gr.Row():\n", " with gr.Column():\n", " file = gr.File()\n", " btn = gr.Button(\"Upload\")\n", " with gr.Column():\n", " output_file = gr.File()\n", " btn.click(\n", " lambda s: (s),\n", " file,\n", " output_file,\n", " )\n", " with gr.Row():\n", " with gr.Column():\n", " img = gr.Image(type=\"filepath\")\n", " btn_2 = gr.Button(\"Upload\")\n", " with gr.Column():\n", " output_file_2 = gr.File()\n", " btn_2.click(\n", " lambda s: (s),\n", " img,\n", " output_file_2,\n", " )\n", " with gr.Row():\n", " with gr.Column():\n", " audio = gr.Audio(type=\"filepath\")\n", " btn_3 = gr.Button(\"Upload\")\n", " with gr.Column():\n", " output_file_3 = gr.File()\n", " btn_3.click(\n", " lambda s: (s),\n", " audio,\n", " output_file_3,\n", " )\n", " with gr.Row():\n", " with gr.Column():\n", " video = gr.Video()\n", " btn_3 = gr.Button(\"Upload\")\n", " with gr.Column():\n", " output_file_4 = gr.File()\n", " btn_3.click(\n", " lambda s: (s),\n", " video,\n", " output_file_4,\n", " )\n", " with gr.Row():\n", " with gr.Column():\n", " model3d = gr.Model3D()\n", " btn_4 = gr.Button(\"Upload\")\n", " with gr.Column():\n", " output_file_4 = gr.File()\n", " btn_4.click(\n", " lambda s: (s),\n", " model3d,\n", " output_file_4,\n", " )\n", "\n", " with gr.Row():\n", " with gr.Column():\n", " gallery = gr.Gallery()\n", " btn_5 = gr.Button(\"Upload\")\n", " with gr.Column():\n", " output_file_5 = gr.File(file_count=\"multiple\")\n", " btn_5.click(\n", " lambda s: [x[0] for x in s],\n", " gallery,\n", " output_file_5,\n", " )\n", " # with gr.Row():\n", " # with gr.Column():\n", " # df = gr.Dataframe()\n", " # btn_6 = gr.Button(\"Upload\")\n", " # with gr.Column():\n", " # output_file_6 = gr.File()\n", " # btn_6.click(\n", " # lambda s: (s),\n", " # df,\n", " # output_file_6,\n", " # )\n", " with gr.Row():\n", " with gr.Column():\n", " imageslider = gr.ImageSlider(type=\"filepath\")\n", " btn_7 = gr.Button(\"Upload\")\n", " with gr.Column():\n", " output_file_7 = gr.File()\n", " btn_7.click(\n", " lambda s: s[0],\n", " imageslider,\n", " output_file_7,\n", " )\n", " with gr.Row():\n", " with gr.Column():\n", " text = gr.MultimodalTextbox()\n", " btn_8 = gr.Button(\"Upload\")\n", " with gr.Column():\n", " output_file_8 = gr.File()\n", " btn_8.click(\n", " lambda s: s[\"files\"],\n", " text,\n", " output_file_8,\n", " )\n", "\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch(\n", " allowed_paths=[\"/private/var/folders/3w/6btg016509v7b2lz9h7vwqv00000gn/T\"]\n", " )\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
with gr.Blocks() as demo:
|
| 5 |
+
gr.Markdown("# Pending Input Components")
|
| 6 |
+
with gr.Row():
|
| 7 |
+
with gr.Column():
|
| 8 |
+
file = gr.File()
|
| 9 |
+
btn = gr.Button("Upload")
|
| 10 |
+
with gr.Column():
|
| 11 |
+
output_file = gr.File()
|
| 12 |
+
btn.click(
|
| 13 |
+
lambda s: (s),
|
| 14 |
+
file,
|
| 15 |
+
output_file,
|
| 16 |
+
)
|
| 17 |
+
with gr.Row():
|
| 18 |
+
with gr.Column():
|
| 19 |
+
img = gr.Image(type="filepath")
|
| 20 |
+
btn_2 = gr.Button("Upload")
|
| 21 |
+
with gr.Column():
|
| 22 |
+
output_file_2 = gr.File()
|
| 23 |
+
btn_2.click(
|
| 24 |
+
lambda s: (s),
|
| 25 |
+
img,
|
| 26 |
+
output_file_2,
|
| 27 |
+
)
|
| 28 |
+
with gr.Row():
|
| 29 |
+
with gr.Column():
|
| 30 |
+
audio = gr.Audio(type="filepath")
|
| 31 |
+
btn_3 = gr.Button("Upload")
|
| 32 |
+
with gr.Column():
|
| 33 |
+
output_file_3 = gr.File()
|
| 34 |
+
btn_3.click(
|
| 35 |
+
lambda s: (s),
|
| 36 |
+
audio,
|
| 37 |
+
output_file_3,
|
| 38 |
+
)
|
| 39 |
+
with gr.Row():
|
| 40 |
+
with gr.Column():
|
| 41 |
+
video = gr.Video()
|
| 42 |
+
btn_3 = gr.Button("Upload")
|
| 43 |
+
with gr.Column():
|
| 44 |
+
output_file_4 = gr.File()
|
| 45 |
+
btn_3.click(
|
| 46 |
+
lambda s: (s),
|
| 47 |
+
video,
|
| 48 |
+
output_file_4,
|
| 49 |
+
)
|
| 50 |
+
with gr.Row():
|
| 51 |
+
with gr.Column():
|
| 52 |
+
model3d = gr.Model3D()
|
| 53 |
+
btn_4 = gr.Button("Upload")
|
| 54 |
+
with gr.Column():
|
| 55 |
+
output_file_4 = gr.File()
|
| 56 |
+
btn_4.click(
|
| 57 |
+
lambda s: (s),
|
| 58 |
+
model3d,
|
| 59 |
+
output_file_4,
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
with gr.Row():
|
| 63 |
+
with gr.Column():
|
| 64 |
+
gallery = gr.Gallery()
|
| 65 |
+
btn_5 = gr.Button("Upload")
|
| 66 |
+
with gr.Column():
|
| 67 |
+
output_file_5 = gr.File(file_count="multiple")
|
| 68 |
+
btn_5.click(
|
| 69 |
+
lambda s: [x[0] for x in s],
|
| 70 |
+
gallery,
|
| 71 |
+
output_file_5,
|
| 72 |
+
)
|
| 73 |
+
# with gr.Row():
|
| 74 |
+
# with gr.Column():
|
| 75 |
+
# df = gr.Dataframe()
|
| 76 |
+
# btn_6 = gr.Button("Upload")
|
| 77 |
+
# with gr.Column():
|
| 78 |
+
# output_file_6 = gr.File()
|
| 79 |
+
# btn_6.click(
|
| 80 |
+
# lambda s: (s),
|
| 81 |
+
# df,
|
| 82 |
+
# output_file_6,
|
| 83 |
+
# )
|
| 84 |
+
with gr.Row():
|
| 85 |
+
with gr.Column():
|
| 86 |
+
imageslider = gr.ImageSlider(type="filepath")
|
| 87 |
+
btn_7 = gr.Button("Upload")
|
| 88 |
+
with gr.Column():
|
| 89 |
+
output_file_7 = gr.File()
|
| 90 |
+
btn_7.click(
|
| 91 |
+
lambda s: s[0],
|
| 92 |
+
imageslider,
|
| 93 |
+
output_file_7,
|
| 94 |
+
)
|
| 95 |
+
with gr.Row():
|
| 96 |
+
with gr.Column():
|
| 97 |
+
text = gr.MultimodalTextbox()
|
| 98 |
+
btn_8 = gr.Button("Upload")
|
| 99 |
+
with gr.Column():
|
| 100 |
+
output_file_8 = gr.File()
|
| 101 |
+
btn_8.click(
|
| 102 |
+
lambda s: s["files"],
|
| 103 |
+
text,
|
| 104 |
+
output_file_8,
|
| 105 |
+
)
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
if __name__ == "__main__":
|
| 109 |
+
demo.launch(
|
| 110 |
+
allowed_paths=["/private/var/folders/3w/6btg016509v7b2lz9h7vwqv00000gn/T"]
|
| 111 |
+
)
|