Update app.py
Browse files
app.py
CHANGED
@@ -70,29 +70,35 @@ with gr.Blocks() as demo:
|
|
70 |
image = gr.Image(label="Upload Image")
|
71 |
prompt = gr.Textbox(label="Prompt")
|
72 |
add_button = gr.Button("Add to Dataset")
|
73 |
-
|
|
|
74 |
|
75 |
index = gr.Number(label="Index to Edit/Delete", precision=0)
|
76 |
new_prompt = gr.Textbox(label="New Prompt")
|
77 |
edit_button = gr.Button("Edit Prompt")
|
78 |
-
|
|
|
79 |
|
80 |
delete_button = gr.Button("Delete from Dataset")
|
81 |
-
|
|
|
82 |
|
83 |
with gr.Tab("Upload Dataset"):
|
84 |
upload_dataset_name = gr.Textbox(label="Dataset Name")
|
85 |
upload_file = gr.File(label="Upload JSONL File")
|
86 |
upload_button = gr.Button("Upload Dataset")
|
87 |
-
|
|
|
88 |
|
89 |
with gr.Tab("Generate/Download Dataset"):
|
90 |
generate_button = gr.Button("Generate Dataset")
|
91 |
-
|
|
|
92 |
|
93 |
with gr.Tab("View Dataset"):
|
94 |
view_dataset_name = gr.Textbox(label="Dataset Name")
|
95 |
view_button = gr.Button("View Dataset")
|
96 |
-
|
|
|
97 |
|
98 |
demo.launch()
|
|
|
70 |
image = gr.Image(label="Upload Image")
|
71 |
prompt = gr.Textbox(label="Prompt")
|
72 |
add_button = gr.Button("Add to Dataset")
|
73 |
+
add_output = gr.Textbox()
|
74 |
+
add_button.click(add_to_dataset, inputs=[dataset_name, image, prompt], outputs=add_output)
|
75 |
|
76 |
index = gr.Number(label="Index to Edit/Delete", precision=0)
|
77 |
new_prompt = gr.Textbox(label="New Prompt")
|
78 |
edit_button = gr.Button("Edit Prompt")
|
79 |
+
edit_output = gr.Textbox()
|
80 |
+
edit_button.click(edit_dataset, inputs=[dataset_name, index, new_prompt], outputs=edit_output)
|
81 |
|
82 |
delete_button = gr.Button("Delete from Dataset")
|
83 |
+
delete_output = gr.Textbox()
|
84 |
+
delete_button.click(delete_from_dataset, inputs=[dataset_name, index], outputs=delete_output)
|
85 |
|
86 |
with gr.Tab("Upload Dataset"):
|
87 |
upload_dataset_name = gr.Textbox(label="Dataset Name")
|
88 |
upload_file = gr.File(label="Upload JSONL File")
|
89 |
upload_button = gr.Button("Upload Dataset")
|
90 |
+
upload_output = gr.Textbox()
|
91 |
+
upload_button.click(load_dataset, inputs=[upload_dataset_name, upload_file], outputs=upload_output)
|
92 |
|
93 |
with gr.Tab("Generate/Download Dataset"):
|
94 |
generate_button = gr.Button("Generate Dataset")
|
95 |
+
generate_output = gr.File()
|
96 |
+
generate_button.click(generate_dataset, inputs=[dataset_name], outputs=generate_output)
|
97 |
|
98 |
with gr.Tab("View Dataset"):
|
99 |
view_dataset_name = gr.Textbox(label="Dataset Name")
|
100 |
view_button = gr.Button("View Dataset")
|
101 |
+
view_output = gr.JSON()
|
102 |
+
view_button.click(lambda name: datasets.get(name, []), inputs=[view_dataset_name], outputs=view_output)
|
103 |
|
104 |
demo.launch()
|