redxican commited on
Commit
2b99558
·
verified ·
1 Parent(s): 3cd7f15

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -97
app.py CHANGED
@@ -776,75 +776,6 @@ def display_pdf_preview(file_path, model_name):
776
  scrolling=True
777
  )
778
 
779
- def get_high_accuracy_models(limit=8):
780
- """Get models with highest extraction quality"""
781
- if DB_PATH is None:
782
- return []
783
- conn = sqlite3.connect(DB_PATH)
784
- cursor = conn.cursor()
785
-
786
- high_accuracy = []
787
-
788
- try:
789
- cursor.execute("""
790
- SELECT full_data, quality FROM documents
791
- WHERE quality IN ('excellent', 'good')
792
- ORDER BY
793
- CASE quality
794
- WHEN 'excellent' THEN 1
795
- WHEN 'good' THEN 2
796
- ELSE 3
797
- END,
798
- import_date DESC
799
- LIMIT 200
800
- """)
801
-
802
- rows = cursor.fetchall()
803
- seen_models = set()
804
-
805
- for row in rows:
806
- if len(high_accuracy) >= limit:
807
- break
808
-
809
- try:
810
- data = json.loads(row[0])
811
- models = data.get('models', [])
812
- specs = data.get('specs', {})
813
-
814
- filled_specs = sum(1 for v in specs.values() if v and v != 'N/A')
815
-
816
- if models and filled_specs >= 4:
817
- for model in models:
818
- if model not in seen_models:
819
- product_type = get_product_type(model)
820
-
821
- type_count = sum(1 for item in high_accuracy if get_product_type(item['model']) == product_type)
822
- if type_count >= 2:
823
- continue
824
-
825
- seen_models.add(model)
826
- high_accuracy.append({
827
- 'model': model,
828
- 'quality': row[1],
829
- 'spec_count': filled_specs,
830
- 'product_type': product_type
831
- })
832
-
833
- if len(high_accuracy) >= limit:
834
- break
835
- except:
836
- continue
837
-
838
- finally:
839
- conn.close()
840
-
841
- high_accuracy.sort(key=lambda x: (
842
- 0 if x['quality'] == 'excellent' else 1,
843
- -x['spec_count']
844
- ))
845
-
846
- return high_accuracy[:limit]
847
-
848
  def display_bookmarked_models():
849
  """Display bookmarked models section with optimized toggle"""
850
  if not st.session_state.bookmarked_models:
@@ -1035,34 +966,6 @@ with col2:
1035
  if selected:
1036
  st.session_state.selected_model = selected
1037
 
1038
- # High Accuracy Models
1039
- with st.expander("⭐ Example Models - Click to expand", expanded=False):
1040
- st.caption("Examples of models with comprehensive data")
1041
-
1042
- high_accuracy = get_high_accuracy_models()
1043
- if high_accuracy:
1044
- cols = st.columns(4)
1045
- col_idx = 0
1046
-
1047
- for item in high_accuracy:
1048
- with cols[col_idx % 4]:
1049
- if st.button(
1050
- f"{item['model']}",
1051
- key=f"ha_{item['model']}",
1052
- use_container_width=True,
1053
- help=f"{item['product_type']} - {item['spec_count']} specifications"
1054
- ):
1055
- st.session_state.selected_model = item['model']
1056
- st.rerun()
1057
-
1058
- st.caption(f"{item['product_type']}")
1059
- quality_class = f"quality-{item['quality']}"
1060
- quality_label = "⭐ Excellent" if item['quality'] == 'excellent' else "✓ Good"
1061
- st.markdown(f'<span class="quality-badge {quality_class}">{quality_label}</span>',
1062
- unsafe_allow_html=True)
1063
-
1064
- col_idx += 1
1065
-
1066
  # Display selected model
1067
  if selected and selected != '':
1068
  st.markdown("---")
 
776
  scrolling=True
777
  )
778
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
779
  def display_bookmarked_models():
780
  """Display bookmarked models section with optimized toggle"""
781
  if not st.session_state.bookmarked_models:
 
966
  if selected:
967
  st.session_state.selected_model = selected
968
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
969
  # Display selected model
970
  if selected and selected != '':
971
  st.markdown("---")