Preethamreddy799 commited on
Commit
69d157f
·
1 Parent(s): 3309275

Add application file

Browse files
Files changed (1) hide show
  1. app.py +39 -0
app.py CHANGED
@@ -1,5 +1,26 @@
1
  import streamlit as st
 
 
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  # Streamlit app interface
5
  st.title("Test Case Prediction App")
@@ -7,3 +28,21 @@ st.write("Enter the test case criteria below to generate test steps and expected
7
 
8
  # Input section
9
  user_input = st.text_area("Input Test Case Criteria", "")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import pickle
3
+ import numpy as np
4
 
5
+ downloads_path = '/Users/preethamreddygollapalli/Downloads/'
6
+
7
+ # Load the saved models
8
+ with open(downloads_path + 'model_test_steps.pkl', 'rb') as file:
9
+ model_test_steps = pickle.load(file)
10
+
11
+ with open(downloads_path + 'model_expected_result.pkl', 'rb') as file:
12
+ model_expected_result = pickle.load(file)
13
+
14
+ # Function to process input and make predictions
15
+ def predict_test_steps(input_embedding):
16
+ input_array = np.array(input_embedding).reshape((1, 1, len(input_embedding)))
17
+ predicted_steps = model_test_steps.predict(input_array)
18
+ return predicted_steps[0][0] # Adjust according to the model's output structure
19
+
20
+ def predict_expected_result(input_embedding):
21
+ input_array = np.array(input_embedding).reshape((1, 1, len(input_embedding)))
22
+ predicted_result = model_expected_result.predict(input_array)
23
+ return predicted_result[0][0] # Adjust according to the model's output structure
24
 
25
  # Streamlit app interface
26
  st.title("Test Case Prediction App")
 
28
 
29
  # Input section
30
  user_input = st.text_area("Input Test Case Criteria", "")
31
+
32
+ if st.button("Generate Predictions"):
33
+ if user_input:
34
+ # Simple tokenization and embedding logic (you might need to match this to your training process)
35
+ input_embedding = [0] * 100 # Replace with actual embedding method for user input
36
+
37
+ # Predict using the loaded models
38
+ predicted_test_steps = predict_test_steps(input_embedding)
39
+ predicted_expected_result = predict_expected_result(input_embedding)
40
+
41
+ # Display the results
42
+ st.subheader("Predicted Test Steps")
43
+ st.write(predicted_test_steps)
44
+
45
+ st.subheader("Predicted Expected Result")
46
+ st.write(predicted_expected_result)
47
+ else:
48
+ st.warning("Please enter test case criteria before generating predictions.")