tykiww commited on
Commit
bfbbbea
1 Parent(s): f82747d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -38
app.py CHANGED
@@ -5,7 +5,9 @@ import json
5
 
6
  # Specialized imports
7
  #from utilities.modeling import modeling
8
- from datasets import load_dataset
 
 
9
 
10
 
11
  # Module imports
@@ -39,36 +41,6 @@ class update_visibility:
39
  else:
40
  return gr.UploadButton(visible=bool(0))
41
 
42
- class get_files:
43
-
44
- def predefined_dataset(dataset_name):
45
- global dataset # bad practice, I know... But just bear with me. Will later update to state dict.
46
- dataset = load_dataset(dataset_name, split = "train")
47
- return 'Successfully loaded dataset'
48
-
49
- def uploaded_dataset(file):
50
- global dataset # bad practice, I know... But just bear with me. Will later update to state dict.
51
- dataset = []
52
- if file is None:
53
- return "File not found. Please upload the file again."
54
- try:
55
- with open(file,'r') as file:
56
- for line in file:
57
- dataset.append(json.loads(line.strip()))
58
- return "File retrieved."
59
- except FileNotFoundError:
60
- return "File not found. Please upload the file again."
61
-
62
- def load_markdown_file(file_path):
63
- try:
64
- with open(file_path, 'r') as f:
65
- return f.read()
66
- except FileNotFoundError:
67
- return "File not found. Please check the file path."
68
- except Exception as e:
69
- return f"Error loading file: {str(e)}"
70
-
71
-
72
  def train(model_name,
73
  inject_prompt,
74
  dataset_predefined,
@@ -93,13 +65,6 @@ def train(model_name,
93
  return f"Hello!! Using model: {model_name} with template: {inject_prompt}"
94
 
95
 
96
- def submit_weights(model, repository, model_out_name, token):
97
- """submits model to repository"""
98
- repo = repository + '/' + model_out_name
99
-
100
- model.push_to_hub(repo, token = token)
101
- tokenizer.push_to_hub(repo, token = token)
102
- return 0
103
 
104
  ##################################### App UI #######################################
105
 
 
5
 
6
  # Specialized imports
7
  #from utilities.modeling import modeling
8
+
9
+ # server import
10
+ from server import get_files, submit_weights #, train_model, submit_weights
11
 
12
 
13
  # Module imports
 
41
  else:
42
  return gr.UploadButton(visible=bool(0))
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  def train(model_name,
45
  inject_prompt,
46
  dataset_predefined,
 
65
  return f"Hello!! Using model: {model_name} with template: {inject_prompt}"
66
 
67
 
 
 
 
 
 
 
 
68
 
69
  ##################################### App UI #######################################
70