aisltnab commited on
Commit
b31bf5b
·
verified ·
1 Parent(s): 870ebfe

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +28 -13
run.py CHANGED
@@ -1,19 +1,34 @@
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()
 
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()