throaway2854 commited on
Commit
a5c4d00
·
verified ·
1 Parent(s): 39e4df6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -34
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.Tab("Create/Edit Dataset"):
69
- dataset_name = gr.Textbox(label="Dataset Name")
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()
 
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()