suryadev1 commited on
Commit
5549b66
·
1 Parent(s): 4708b88

removed the uploading of data

Browse files
Files changed (5) hide show
  1. .gitignore +2 -0
  2. app.py +15 -14
  3. new_test_saved_finetuned_model.py +3 -1
  4. result.txt +1 -1
  5. test.txt +0 -0
.gitignore CHANGED
@@ -1,2 +1,4 @@
1
  train_info.txt
 
 
2
  ratio_proportion_change3_2223/sch_largest_100-coded/logs/
 
1
  train_info.txt
2
+ train.txt
3
+ train_label.txt
4
  ratio_proportion_change3_2223/sch_largest_100-coded/logs/
app.py CHANGED
@@ -10,18 +10,19 @@ from sklearn.metrics import roc_curve, auc
10
  import pandas as pd
11
  # Define the function to process the input file and model selection
12
 
13
- def process_file(file,label,info,model_name,inc_slider,progress=Progress(track_tqdm=True)):
14
  # progress = gr.Progress(track_tqdm=True)
 
15
  progress(0, desc="Starting the processing")
16
- with open(file.name, 'r') as f:
17
- content = f.read()
18
- saved_test_dataset = "train.txt"
19
- saved_test_label = "train_label.txt"
20
- saved_train_info="train_info.txt"
21
  # Save the uploaded file content to a specified location
22
- shutil.copyfile(file.name, saved_test_dataset)
23
- shutil.copyfile(label.name, saved_test_label)
24
- shutil.copyfile(info.name, saved_train_info)
25
 
26
 
27
  # Load the test_info file and the graduation rate file
@@ -324,12 +325,12 @@ tbody.svelte-18wv37q>tr.svelte-18wv37q:nth-child(odd) {
324
  gr.Markdown("<p class='description'>Upload a .txt file and select a model from the dropdown menu.</p>")
325
 
326
  with gr.Row():
327
- file_input = gr.File(label="Upload a test file", file_types=['.txt'], elem_classes="file-box")
328
- label_input = gr.File(label="Upload test labels", file_types=['.txt'], elem_classes="file-box")
329
 
330
- info_input = gr.File(label="Upload test info", file_types=['.txt'], elem_classes="file-box")
331
 
332
- model_dropdown = gr.Dropdown(choices=models, label="Select Finetune Task", elem_classes="dropdown-menu")
333
 
334
 
335
  increment_slider = gr.Slider(minimum=1, maximum=100, step=1, label="Schools Percentage", value=1)
@@ -340,7 +341,7 @@ tbody.svelte-18wv37q>tr.svelte-18wv37q:nth-child(odd) {
340
 
341
  btn = gr.Button("Submit")
342
 
343
- btn.click(fn=process_file, inputs=[file_input,label_input,info_input,model_dropdown,increment_slider], outputs=[output_text,output_image])
344
 
345
 
346
  # Launch the app
 
10
  import pandas as pd
11
  # Define the function to process the input file and model selection
12
 
13
+ def process_file(model_name,inc_slider,progress=Progress(track_tqdm=True)):
14
  # progress = gr.Progress(track_tqdm=True)
15
+
16
  progress(0, desc="Starting the processing")
17
+ # with open(file.name, 'r') as f:
18
+ # content = f.read()
19
+ # saved_test_dataset = "train.txt"
20
+ # saved_test_label = "train_label.txt"
21
+ # saved_train_info="train_info.txt"
22
  # Save the uploaded file content to a specified location
23
+ # shutil.copyfile(file.name, saved_test_dataset)
24
+ # shutil.copyfile(label.name, saved_test_label)
25
+ # shutil.copyfile(info.name, saved_train_info)
26
 
27
 
28
  # Load the test_info file and the graduation rate file
 
325
  gr.Markdown("<p class='description'>Upload a .txt file and select a model from the dropdown menu.</p>")
326
 
327
  with gr.Row():
328
+ # file_input = gr.File(label="Upload a test file", file_types=['.txt'], elem_classes="file-box")
329
+ # label_input = gr.File(label="Upload test labels", file_types=['.txt'], elem_classes="file-box")
330
 
331
+ # info_input = gr.File(label="Upload test info", file_types=['.txt'], elem_classes="file-box")
332
 
333
+ model_dropdown = gr.Dropdown(choices=models, label="Select Finetune Task", elem_classes="dropdown-menu")
334
 
335
 
336
  increment_slider = gr.Slider(minimum=1, maximum=100, step=1, label="Schools Percentage", value=1)
 
341
 
342
  btn = gr.Button("Submit")
343
 
344
+ btn.click(fn=process_file, inputs=[model_dropdown,increment_slider], outputs=[output_text,output_image])
345
 
346
 
347
  # Launch the app
new_test_saved_finetuned_model.py CHANGED
@@ -440,7 +440,9 @@ class BERTFineTuneCalibratedTrainer:
440
  with open("result.txt", 'w') as file:
441
  for key, value in final_msg.items():
442
  file.write(f"{key}: {value}\n")
443
-
 
 
444
  print(final_msg)
445
  fpr, tpr, thresholds = roc_curve(tlabels, positive_class_probs)
446
  f.close()
 
440
  with open("result.txt", 'w') as file:
441
  for key, value in final_msg.items():
442
  file.write(f"{key}: {value}\n")
443
+ with open("plabels.txt","w") as file:
444
+ file.write(plabels)
445
+
446
  print(final_msg)
447
  fpr, tpr, thresholds = roc_curve(tlabels, positive_class_probs)
448
  f.close()
result.txt CHANGED
@@ -3,5 +3,5 @@ total_acc: 69.52861952861953
3
  precisions: 0.7336375047795977
4
  recalls: 0.6952861952861953
5
  f1_scores: 0.6858177547541179
6
- time_taken_from_start: 28.49159860610962
7
  auc_score: 0.7738852057033876
 
3
  precisions: 0.7336375047795977
4
  recalls: 0.6952861952861953
5
  f1_scores: 0.6858177547541179
6
+ time_taken_from_start: 16.031665802001953
7
  auc_score: 0.7738852057033876
test.txt DELETED
The diff for this file is too large to render. See raw diff