OzoneAsai commited on
Commit
e275cfb
·
1 Parent(s): cc6b8aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -27,7 +27,7 @@ file_paths = []
27
  # Function to get Gradio NSFW prediction
28
  def get_gradio_nsfw_prediction(image_path):
29
  result = client_nsfw.predict(image_path, api_name="/predict")
30
- return result["label"] # Assuming the label is the prediction result
31
 
32
  # Define the function to generate a download link for a file
33
  def get_binary_file_downloader_html(file_path, label="Download"):
@@ -94,7 +94,7 @@ def display_images(images):
94
  st.write(f"**Good value:** {good_values[i]}")
95
  st.write(f"**Timestamp:** {timestamp}")
96
 
97
- if st.session_state.blur_option and gradio_nsfw_prediction.lower() == "nsfw":
98
  blurred_img = apply_blur(file_path)
99
  st.image(blurred_img, caption=os.path.basename(file_path), use_column_width=True)
100
  else:
 
27
  # Function to get Gradio NSFW prediction
28
  def get_gradio_nsfw_prediction(image_path):
29
  result = client_nsfw.predict(image_path, api_name="/predict")
30
+ return result # Return the entire dictionary
31
 
32
  # Define the function to generate a download link for a file
33
  def get_binary_file_downloader_html(file_path, label="Download"):
 
94
  st.write(f"**Good value:** {good_values[i]}")
95
  st.write(f"**Timestamp:** {timestamp}")
96
 
97
+ if st.session_state.blur_option and gradio_nsfw_prediction.get("label", "").lower() == "nsfw":
98
  blurred_img = apply_blur(file_path)
99
  st.image(blurred_img, caption=os.path.basename(file_path), use_column_width=True)
100
  else: