saakshigupta commited on
Commit
a46a2af
·
verified ·
1 Parent(s): 04ef523

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -21
app.py CHANGED
@@ -71,27 +71,6 @@ def check_environment():
71
  except:
72
  st.sidebar.write("Torch not available or error checking")
73
 
74
- # Run environment check
75
- check_environment()
76
-
77
- # Run Hugging Face Hub connectivity test
78
- if st.session_state.debug:
79
- test_huggingface_hub_access()
80
-
81
- # Main title and description
82
- st.title("Deepfake Image Analyser")
83
- st.markdown("Analyse images for deepfake manipulation")
84
-
85
- # Check for GPU availability
86
- def check_gpu():
87
- if torch.cuda.is_available():
88
- gpu_info = torch.cuda.get_device_properties(0)
89
- st.sidebar.success(f"✅ GPU available: {gpu_info.name} ({gpu_info.total_memory / (1024**3):.2f} GB)")
90
- return True
91
- else:
92
- st.sidebar.warning("⚠️ No GPU detected. Analysis will be slower.")
93
- return False
94
-
95
  # Test Hugging Face Hub connectivity
96
  def test_huggingface_hub_access():
97
  """Test connectivity to the Hugging Face Hub"""
@@ -112,6 +91,31 @@ def test_huggingface_hub_access():
112
  st.sidebar.error(traceback.format_exc())
113
  return False
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  # Sidebar components
116
  st.sidebar.title("About")
117
  st.sidebar.markdown("""
 
71
  except:
72
  st.sidebar.write("Torch not available or error checking")
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  # Test Hugging Face Hub connectivity
75
  def test_huggingface_hub_access():
76
  """Test connectivity to the Hugging Face Hub"""
 
91
  st.sidebar.error(traceback.format_exc())
92
  return False
93
 
94
+ # Run environment check first
95
+ check_environment()
96
+
97
+ # Run Hugging Face Hub connectivity test if debug is enabled
98
+ if st.session_state.debug:
99
+ try:
100
+ test_huggingface_hub_access()
101
+ except Exception as e:
102
+ st.sidebar.error(f"Error testing HuggingFace Hub: {str(e)}")
103
+ log_debug(f"HF Hub test error: {str(e)}")
104
+
105
+ # Main title and description
106
+ st.title("Deepfake Image Analyser")
107
+ st.markdown("Analyse images for deepfake manipulation")
108
+
109
+ # Check for GPU availability
110
+ def check_gpu():
111
+ if torch.cuda.is_available():
112
+ gpu_info = torch.cuda.get_device_properties(0)
113
+ st.sidebar.success(f"✅ GPU available: {gpu_info.name} ({gpu_info.total_memory / (1024**3):.2f} GB)")
114
+ return True
115
+ else:
116
+ st.sidebar.warning("⚠️ No GPU detected. Analysis will be slower.")
117
+ return False
118
+
119
  # Sidebar components
120
  st.sidebar.title("About")
121
  st.sidebar.markdown("""