Shekswess commited on
Commit
d8a66e4
·
1 Parent(s): 7d83413

Adding stop button

Browse files
Files changed (1) hide show
  1. app.py +16 -12
app.py CHANGED
@@ -149,11 +149,7 @@ def ui_main():
149
  <img src="./assets/logo_header.png" alt="Header Image" style="display: block; margin-left: auto; margin-right: auto; width: 50%;"/>
150
  <h1>SynthGenAI Dataset Generator</h1>
151
  </div>
152
- """
153
- )
154
 
155
- gr.Markdown(
156
- """
157
  ## Overview 🧐
158
  SynthGenAI is designed to be modular and can be easily extended to include different API providers for LLMs and new features.
159
 
@@ -161,6 +157,8 @@ def ui_main():
161
  Interest in synthetic data generation has surged recently, driven by the growing recognition of data as a critical asset in AI development. Synthetic data generation addresses challenges by allowing us to create diverse and useful datasets using current pre-trained Large Language Models (LLMs).
162
 
163
  [GitHub Repository](https://github.com/Shekswess/synthgenai/tree/main) | [Documentation](https://shekswess.github.io/synthgenai/)
 
 
164
  """
165
  )
166
 
@@ -214,18 +212,24 @@ def ui_main():
214
  placeholder="Comma-separated environment variables (e.g., KEY1=VALUE1, KEY2=VALUE2)",
215
  value="HUGGINGFACE_API_KEY=hf_1234566789912345677889, OPENAI_API_KEY=sk-1234566789912345677889",
216
  )
217
- gr.Markdown(
218
- """
219
- For more information on which LLMs are allowed and how they can be used, please refer to the [documentation](https://shekswess.github.io/synthgenai/llm_providers/).
220
- """
221
- )
222
 
223
  generate_button = gr.Button("Generate Dataset")
224
- stop_button = gr.Button("Stop Generation")
225
  output = gr.Textbox(label="Operation Result", value="")
226
 
 
 
 
 
 
 
 
 
 
 
 
227
  generate_button.click(
228
- generate_synthetic_dataset,
229
  inputs=[
230
  llm_model,
231
  temperature,
@@ -244,7 +248,7 @@ def ui_main():
244
  )
245
 
246
  stop_button.click(
247
- stop_generation,
248
  outputs=output,
249
  )
250
 
 
149
  <img src="./assets/logo_header.png" alt="Header Image" style="display: block; margin-left: auto; margin-right: auto; width: 50%;"/>
150
  <h1>SynthGenAI Dataset Generator</h1>
151
  </div>
 
 
152
 
 
 
153
  ## Overview 🧐
154
  SynthGenAI is designed to be modular and can be easily extended to include different API providers for LLMs and new features.
155
 
 
157
  Interest in synthetic data generation has surged recently, driven by the growing recognition of data as a critical asset in AI development. Synthetic data generation addresses challenges by allowing us to create diverse and useful datasets using current pre-trained Large Language Models (LLMs).
158
 
159
  [GitHub Repository](https://github.com/Shekswess/synthgenai/tree/main) | [Documentation](https://shekswess.github.io/synthgenai/)
160
+
161
+ For more information on which LLMs are allowed and how they can be used, please refer to the [documentation](https://shekswess.github.io/synthgenai/llm_providers/).
162
  """
163
  )
164
 
 
212
  placeholder="Comma-separated environment variables (e.g., KEY1=VALUE1, KEY2=VALUE2)",
213
  value="HUGGINGFACE_API_KEY=hf_1234566789912345677889, OPENAI_API_KEY=sk-1234566789912345677889",
214
  )
 
 
 
 
 
215
 
216
  generate_button = gr.Button("Generate Dataset")
217
+ stop_button = gr.Button("Stop Generation", visible=False)
218
  output = gr.Textbox(label="Operation Result", value="")
219
 
220
+ def on_generate_click(*args):
221
+ generate_button.visible = False
222
+ stop_button.visible = True
223
+ return generate_synthetic_dataset(*args)
224
+
225
+ def on_stop_click():
226
+ stop_generation()
227
+ generate_button.visible = True
228
+ stop_button.visible = False
229
+ return "Dataset generation stopped."
230
+
231
  generate_button.click(
232
+ on_generate_click,
233
  inputs=[
234
  llm_model,
235
  temperature,
 
248
  )
249
 
250
  stop_button.click(
251
+ on_stop_click,
252
  outputs=output,
253
  )
254