tykiww commited on
Commit
42cd34a
1 Parent(s): a5e8844

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -10,9 +10,9 @@ from utilities.templates import prompt_template
10
 
11
  conf = get_json_cfg()
12
 
13
- def dropdown_visibility(radio):
14
  value = radio
15
- if value == "Predefined Dataset":
16
  return gr.Dropdown(visible=bool(1))
17
  else:
18
  return gr.Dropdown(visible=bool(0))
@@ -24,9 +24,9 @@ def upload_visibility(radio):
24
  else:
25
  return gr.UploadButton(visible=bool(0))
26
 
27
- def greet(model_name, inject_prompt, name, dataset):
28
  """The model call"""
29
- return f"Hello {name}!! Using model: {model_name} with template: {inject_prompt}"
30
 
31
  ##################################### App UI #######################################
32
  with gr.Blocks() as demo:
@@ -44,12 +44,10 @@ with gr.Blocks() as demo:
44
  # Prompt template
45
  inject_prompt = gr.Textbox(label="Prompt Template",
46
  value=prompt_template())
47
- # Prompt Input
48
- name_input = gr.Textbox(label="Your Name")
49
  # Dataset choice
50
- dataset_choice = gr.Radio(label="Choose Dataset", choices=["Predefined Dataset", "Upload Your Own"], value="Predefined Dataset")
51
- dataset_predefined = gr.Dropdown(label="Predefined Dataset", choices=['1', '2', '3'], value='1', visible=True)
52
- dataset_upload = gr.UploadButton(label="Upload Dataset", file_types=[".pdf",".csv",".jsonl"], visible=False) # gr.File(label="Upload Dataset", visible=False)
53
  dataset_choice.change(dropdown_visibility, dataset_choice, dataset_predefined)
54
  dataset_choice.change(upload_visibility, dataset_choice, dataset_upload)
55
 
@@ -64,7 +62,7 @@ with gr.Blocks() as demo:
64
  tune_btn = gr.Button("Start Fine Tuning")
65
  # Execute button
66
  tune_btn.click(fn=greet,
67
- inputs=[model_name, inject_prompt, name_input, dataset_predefined],
68
  outputs=output)
69
 
70
  ##################################### Launch #######################################
 
10
 
11
  conf = get_json_cfg()
12
 
13
+ def textbox_visibility(radio):
14
  value = radio
15
+ if value == "Hugging Face Hub Dataset":
16
  return gr.Dropdown(visible=bool(1))
17
  else:
18
  return gr.Dropdown(visible=bool(0))
 
24
  else:
25
  return gr.UploadButton(visible=bool(0))
26
 
27
+ def greet(model_name, inject_prompt, dataset):
28
  """The model call"""
29
+ return f"Hello!! Using model: {model_name} with template: {inject_prompt}"
30
 
31
  ##################################### App UI #######################################
32
  with gr.Blocks() as demo:
 
44
  # Prompt template
45
  inject_prompt = gr.Textbox(label="Prompt Template",
46
  value=prompt_template())
 
 
47
  # Dataset choice
48
+ dataset_choice = gr.Radio(label="Choose Dataset", choices=["Hugging Face Hub Dataset", "Upload Your Own"], value="Hugging Face Hub Dataset")
49
+ dataset_predefined = gr.Textbox(label="Hugging Face Hub Dataset", value='yahma/alpaca-cleaned', visible=True)
50
+ dataset_upload = gr.UploadButton(label="Upload Dataset (csv, jsonl, or txt)", file_types=[".csv",".jsonl", ".txt"], visible=False)
51
  dataset_choice.change(dropdown_visibility, dataset_choice, dataset_predefined)
52
  dataset_choice.change(upload_visibility, dataset_choice, dataset_upload)
53
 
 
62
  tune_btn = gr.Button("Start Fine Tuning")
63
  # Execute button
64
  tune_btn.click(fn=greet,
65
+ inputs=[model_name, inject_prompt, dataset_predefined],
66
  outputs=output)
67
 
68
  ##################################### Launch #######################################