Spaces:
Build error
Build error
Update run.py
Browse files
run.py
CHANGED
|
@@ -1,19 +1,34 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
print(history)
|
| 9 |
-
print(task_history)
|
| 10 |
-
return history, task_history
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
chatbot = gr.Chatbot(label='Qwen-VL-Chat', elem_classes="control-height", height=520)
|
| 14 |
-
task_history = gr.State([])
|
| 15 |
with gr.Blocks() as demo:
|
| 16 |
-
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
demo.launch()
|
|
|
|
| 1 |
+
# import gradio as gr
|
| 2 |
+
# import time
|
| 3 |
+
|
| 4 |
+
# def add_file(history, task_history, file):
|
| 5 |
+
# time.sleep(10)
|
| 6 |
+
# history = history + [((file.name,), None)]
|
| 7 |
+
# task_history = task_history + [((file.name,), None)]
|
| 8 |
+
# print(history)
|
| 9 |
+
# print(task_history)
|
| 10 |
+
# return history, task_history
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
# chatbot = gr.Chatbot(label='Qwen-VL-Chat', elem_classes="control-height", height=520)
|
| 14 |
+
# task_history = gr.State([])
|
| 15 |
+
# with gr.Blocks() as demo:
|
| 16 |
+
# addfile_btn = gr.UploadButton("Upload", file_types=["image"])
|
| 17 |
+
# addfile_btn.upload(add_file, [chatbot, task_history, addfile_btn], [chatbot, task_history], show_progress=True)
|
| 18 |
|
| 19 |
+
# demo.launch()
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
def upload_file(files):
|
| 25 |
+
file_paths = [file.name for file in files]
|
| 26 |
+
print(file_paths)
|
| 27 |
+
return file_paths
|
| 28 |
|
|
|
|
|
|
|
| 29 |
with gr.Blocks() as demo:
|
| 30 |
+
file_output = gr.File()
|
| 31 |
+
upload_button = gr.UploadButton("Click to Upload an Image or Video File", file_types=["image", "video"], file_count="multiple")
|
| 32 |
+
upload_button.upload(upload_file, upload_button, file_output)
|
| 33 |
|
| 34 |
demo.launch()
|