ManjinderUNCC commited on
Commit
c2bf1c2
·
verified ·
1 Parent(s): b88663b

Update gradio_interface.py

Browse files
Files changed (1) hide show
  1. gradio_interface.py +1 -29
gradio_interface.py CHANGED
@@ -58,33 +58,5 @@ def evaluate_text(input_text):
58
 
59
  return output_dict
60
 
61
- # Convert predicted and ground truth labels to lists
62
- predicted_labels_list = [1 if predicted_labels[label] else 0 for label in predicted_labels]
63
- ground_truth_labels_list = [ground_truth_labels[label] for label in predicted_labels]
64
-
65
- # Calculate evaluation metrics
66
- accuracy = accuracy_score(ground_truth_labels_list, predicted_labels_list)
67
- precision = precision_score(ground_truth_labels_list, predicted_labels_list, average='weighted')
68
- recall = recall_score(ground_truth_labels_list, predicted_labels_list, average='weighted')
69
- f1 = f1_score(ground_truth_labels_list, predicted_labels_list, average='weighted')
70
-
71
- # Additional classification report
72
- report = classification_report(ground_truth_labels_list, predicted_labels_list)
73
-
74
- # Construct output dictionary
75
- output_dict = {
76
- "PredictedLabels": predicted_labels,
77
- "EvaluationMetrics": {
78
- "Accuracy": accuracy,
79
- "Precision": precision,
80
- "Recall": recall,
81
- "F1-Score": f1,
82
- "ClassificationReport": report
83
- }
84
- }
85
-
86
- return output_dict
87
-
88
  # Gradio Interface
89
- iface = gr.Interface(fn=evaluate_text, inputs="text", outputs="json", title="Text Evaluation-Manjinder", description="Enter your text")
90
- iface.launch(share=True)
 
58
 
59
  return output_dict
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  # Gradio Interface
62
+ iface = gr.Interface(fn=evaluate_text, inputs="text", outputs