basilboy commited on
Commit
7c87bff
·
verified ·
1 Parent(s): 466fc1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -1,9 +1,19 @@
1
  import streamlit as st
2
  from utils import validate_sequence, predict
3
  from model import models
 
4
 
5
  def main():
6
- st.title("AA Property Inference Demo")
 
 
 
 
 
 
 
 
 
7
 
8
  # User input: Text and CSV
9
  sequence = st.text_input("Enter your amino acid sequence:")
@@ -21,15 +31,16 @@ def main():
21
  model_results = {}
22
  for model_name, model in models.items():
23
  prediction, confidence = predict(model, seq)
24
- model_results[model_name] = {"Prediction": prediction, "Confidence": confidence}
 
25
  results.append({"Sequence": seq, **model_results})
26
  else:
27
  st.error(f"Invalid sequence: {seq}")
28
-
29
  if results:
30
  st.write("### Results")
31
- st.table(results)
 
32
 
33
  if __name__ == "__main__":
34
  main()
35
-
 
1
  import streamlit as st
2
  from utils import validate_sequence, predict
3
  from model import models
4
+ import pandas as pd
5
 
6
  def main():
7
+ st.title("AA Property Inference Demo", anchor=None)
8
+
9
+ # Apply monospace font to the entire app
10
+ st.markdown("""
11
+ <style>
12
+ .reportview-container {
13
+ font-family: 'Courier New', monospace;
14
+ }
15
+ </style>
16
+ """, unsafe_allow_html=True)
17
 
18
  # User input: Text and CSV
19
  sequence = st.text_input("Enter your amino acid sequence:")
 
31
  model_results = {}
32
  for model_name, model in models.items():
33
  prediction, confidence = predict(model, seq)
34
+ model_results[f"{model_name}_prediction"] = prediction
35
+ model_results[f"{model_name}_confidence"] = round(confidence, 3)
36
  results.append({"Sequence": seq, **model_results})
37
  else:
38
  st.error(f"Invalid sequence: {seq}")
39
+
40
  if results:
41
  st.write("### Results")
42
+ results_df = pd.DataFrame(results)
43
+ st.dataframe(results_df.style.format(precision=3))
44
 
45
  if __name__ == "__main__":
46
  main()