Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
deleted
Browse files- app.py +0 -93
- result.txt +0 -8
- roc_data.pkl +0 -3
- train.txt +0 -0
- train_info.txt +0 -0
- train_label.txt +0 -0
app.py
CHANGED
|
@@ -1,96 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
# import gradio as gr
|
| 4 |
-
# from huggingface_hub import hf_hub_download
|
| 5 |
-
# import pickle
|
| 6 |
-
# import gradio as gr
|
| 7 |
-
# import numpy as np
|
| 8 |
-
# import subprocess
|
| 9 |
-
# import shutil
|
| 10 |
-
# import matplotlib.pyplot as plt
|
| 11 |
-
# from sklearn.metrics import roc_curve, auc
|
| 12 |
-
# # Define the function to process the input file and model selection
|
| 13 |
-
# def process_file(file,label, model_name):
|
| 14 |
-
# with open(file.name, 'r') as f:
|
| 15 |
-
# content = f.read()
|
| 16 |
-
# saved_test_dataset = "train.txt"
|
| 17 |
-
# saved_test_label = "train_label.txt"
|
| 18 |
-
|
| 19 |
-
# # Save the uploaded file content to a specified location
|
| 20 |
-
# shutil.copyfile(file.name, saved_test_dataset)
|
| 21 |
-
# shutil.copyfile(label.name, saved_test_label)
|
| 22 |
-
# # For demonstration purposes, we'll just return the content with the selected model name
|
| 23 |
-
# if(model_name=="FS"):
|
| 24 |
-
# checkpoint="ratio_proportion_change3/output/FS/bert_fine_tuned.model.ep32"
|
| 25 |
-
# elif(model_name=="IS"):
|
| 26 |
-
# checkpoint="ratio_proportion_change3/output/IS/bert_fine_tuned.model.ep14"
|
| 27 |
-
# elif(model_name=="CORRECTNESS"):
|
| 28 |
-
# checkpoint="ratio_proportion_change3/output/correctness/bert_fine_tuned.model.ep48"
|
| 29 |
-
# elif(model_name=="EFFECTIVENESS"):
|
| 30 |
-
# checkpoint="ratio_proportion_change3/output/effectiveness/bert_fine_tuned.model.ep28"
|
| 31 |
-
# else:
|
| 32 |
-
# checkpoint=None
|
| 33 |
-
|
| 34 |
-
# print(checkpoint)
|
| 35 |
-
# # subprocess.run(["python", "src/test_saved_model.py",
|
| 36 |
-
# # "--finetuned_bert_checkpoint",checkpoint
|
| 37 |
-
# # ])
|
| 38 |
-
# result = {}
|
| 39 |
-
# with open("result.txt", 'r') as file:
|
| 40 |
-
# for line in file:
|
| 41 |
-
# key, value = line.strip().split(': ', 1)
|
| 42 |
-
# # print(type(key))
|
| 43 |
-
# if key=='epoch':
|
| 44 |
-
# result[key]=value
|
| 45 |
-
# else:
|
| 46 |
-
# result[key]=float(value)
|
| 47 |
-
# # Create a plot
|
| 48 |
-
# with open("roc_data.pkl", "rb") as f:
|
| 49 |
-
# fpr, tpr, _ = pickle.load(f)
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
# roc_auc = auc(fpr, tpr)
|
| 54 |
-
# fig, ax = plt.subplots()
|
| 55 |
-
# ax.plot(fpr, tpr, color='blue', lw=2, label=f'ROC curve (area = {roc_auc:.2f})')
|
| 56 |
-
# ax.plot([0, 1], [0, 1], color='navy', lw=2, linestyle='--')
|
| 57 |
-
# ax.set(xlabel='False Positive Rate', ylabel='True Positive Rate', title=f'ROC Curve: {model_name}')
|
| 58 |
-
# ax.legend(loc="lower right")
|
| 59 |
-
# ax.grid()
|
| 60 |
-
|
| 61 |
-
# # Save plot to a file
|
| 62 |
-
# plot_path = "plot.png"
|
| 63 |
-
# fig.savefig(plot_path)
|
| 64 |
-
# plt.close(fig)
|
| 65 |
-
|
| 66 |
-
# # Prepare text output
|
| 67 |
-
# text_output = f"Model: {model_name}\nResult:\n{result}"
|
| 68 |
-
|
| 69 |
-
# return text_output,plot_path
|
| 70 |
-
|
| 71 |
-
# # List of models for the dropdown menu
|
| 72 |
-
# models = ["FS", "IS", "CORRECTNESS","EFFECTIVENESS"]
|
| 73 |
-
|
| 74 |
-
# # Create the Gradio interface
|
| 75 |
-
# with gr.Blocks() as demo:
|
| 76 |
-
# gr.Markdown("# ASTRA")
|
| 77 |
-
# gr.Markdown("Upload a .txt file and select a model from the dropdown menu.")
|
| 78 |
-
|
| 79 |
-
# with gr.Row():
|
| 80 |
-
# file_input = gr.File(label="Upload a .txt file", file_types=['.txt'])
|
| 81 |
-
# label_input = gr.File(label="Upload a .txt file", file_types=['.txt'])
|
| 82 |
-
# model_dropdown = gr.Dropdown(choices=models, label="Select a model")
|
| 83 |
-
|
| 84 |
-
# with gr.Row():
|
| 85 |
-
# output_text = gr.Textbox(label="Output Text")
|
| 86 |
-
# output_image = gr.Image(label="Output Plot")
|
| 87 |
-
|
| 88 |
-
# btn = gr.Button("Submit")
|
| 89 |
-
# btn.click(fn=process_file, inputs=[file_input,label_input, model_dropdown], outputs=[output_text,output_image])
|
| 90 |
-
|
| 91 |
-
# # Launch the app
|
| 92 |
-
# demo.launch()
|
| 93 |
-
|
| 94 |
import gradio as gr
|
| 95 |
from huggingface_hub import hf_hub_download
|
| 96 |
import pickle
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import hf_hub_download
|
| 3 |
import pickle
|
result.txt
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
epoch: EP0_test
|
| 2 |
-
avg_loss: 0.8247231508152465
|
| 3 |
-
total_acc: 50.0
|
| 4 |
-
precisions: 0.25
|
| 5 |
-
recalls: 0.5
|
| 6 |
-
f1_scores: 0.3333333333333333
|
| 7 |
-
time_taken_from_start: 77.90863966941833
|
| 8 |
-
auc_score: 0.5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
roc_data.pkl
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:8b84bcb95e30a1c23f399643fc8dd20b57d7a849faf2670a3df9b7d0f9285f34
|
| 3 |
-
size 257
|
|
|
|
|
|
|
|
|
|
|
|
train.txt
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
train_info.txt
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
train_label.txt
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|