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