Spaces:
Build error
Build error
| # import gradio as gr | |
| # import time | |
| # def add_file(history, task_history, file): | |
| # time.sleep(10) | |
| # history = history + [((file.name,), None)] | |
| # task_history = task_history + [((file.name,), None)] | |
| # print(history) | |
| # print(task_history) | |
| # return history, task_history | |
| # chatbot = gr.Chatbot(label='Qwen-VL-Chat', elem_classes="control-height", height=520) | |
| # task_history = gr.State([]) | |
| # with gr.Blocks() as demo: | |
| # addfile_btn = gr.UploadButton("Upload", file_types=["image"]) | |
| # addfile_btn.upload(add_file, [chatbot, task_history, addfile_btn], [chatbot, task_history], show_progress=True) | |
| # demo.launch() | |
| import gradio as gr | |
| import pandas as pd | |
| def upload_file(files): | |
| file_paths = [file.name for file in files] | |
| print(file_paths) | |
| print(file_paths[0][-3:]) | |
| df = pd.read_csv(file_paths[0]) | |
| print(df) | |
| df.to_csv('test1.csv') | |
| df.to_csv(file_paths[0].replace('.csv','_')+'test2.csv') | |
| print([file.name for file in files]) | |
| return file_paths | |
| with gr.Blocks() as demo: | |
| file_output = gr.File() | |
| upload_button = gr.UploadButton("Click to Upload an Image or Video File", file_types=[".csv"]) | |
| upload_button.upload(upload_file, upload_button, file_output) | |
| demo.launch() |