TKM03 commited on
Commit
2eda854
·
verified ·
1 Parent(s): 68c7528

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -101,8 +101,8 @@ def detect(image, confidence_threshold=0.7, detailed_analysis=False):
101
  overall_result = f"{'🚫 LIKELY FAKE' if threshold_predicted == 'Fake' else '✅ LIKELY REAL'} ({confidence_score:.1f}% Confidence)"
102
  aigen_result = f"{aigen_likelihood:.1f}% Likelihood"
103
  deepfake_result = f"{face_manipulation_likelihood:.1f}% Likelihood"
104
-
105
- # Create detailed report
106
  feature_analysis_text = ""
107
  if detailed_analysis:
108
  for k, v in feature_analysis.items():
@@ -129,7 +129,6 @@ def detect(image, confidence_threshold=0.7, detailed_analysis=False):
129
  logger.error(f"Error during analysis: {str(e)}")
130
  raise gr.Error(f"Analysis failed: {str(e)}")
131
 
132
-
133
  # Enhanced UI with professional design
134
  custom_css = """
135
  .container {
@@ -247,11 +246,11 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
247
 
248
  with gr.Column(scale=1):
249
  with gr.Group():
250
- with gr.Box(elem_classes="panel"):
251
- gr.Markdown("<div class='panel-title'>Detection Results</div>")
252
- overall = gr.Textbox(label="Overall Assessment", show_label=True)
253
- aigen = gr.Textbox(label="AI-Generated Content", show_label=True)
254
- deepfake = gr.Textbox(label="Face Manipulation", show_label=True)
255
 
256
  report = gr.Markdown(label="Detailed Report")
257
 
@@ -268,7 +267,7 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
268
  # gr.Examples(
269
  # examples=["examples/real_face.jpg", "examples/fake_face.jpg"],
270
  # inputs=image
271
- # )
272
 
273
  # Launch the application
274
  if __name__ == "__main__":
 
101
  overall_result = f"{'🚫 LIKELY FAKE' if threshold_predicted == 'Fake' else '✅ LIKELY REAL'} ({confidence_score:.1f}% Confidence)"
102
  aigen_result = f"{aigen_likelihood:.1f}% Likelihood"
103
  deepfake_result = f"{face_manipulation_likelihood:.1f}% Likelihood"
104
+
105
+ # Create detailed report - avoiding backslashes in f-string expressions
106
  feature_analysis_text = ""
107
  if detailed_analysis:
108
  for k, v in feature_analysis.items():
 
129
  logger.error(f"Error during analysis: {str(e)}")
130
  raise gr.Error(f"Analysis failed: {str(e)}")
131
 
 
132
  # Enhanced UI with professional design
133
  custom_css = """
134
  .container {
 
246
 
247
  with gr.Column(scale=1):
248
  with gr.Group():
249
+ # Replace Box with a div using Markdown for older Gradio versions
250
+ gr.Markdown("<div class='panel'><div class='panel-title'>Detection Results</div></div>")
251
+ overall = gr.Textbox(label="Overall Assessment", show_label=True)
252
+ aigen = gr.Textbox(label="AI-Generated Content", show_label=True)
253
+ deepfake = gr.Textbox(label="Face Manipulation", show_label=True)
254
 
255
  report = gr.Markdown(label="Detailed Report")
256
 
 
267
  # gr.Examples(
268
  # examples=["examples/real_face.jpg", "examples/fake_face.jpg"],
269
  # inputs=image
270
+ # )
271
 
272
  # Launch the application
273
  if __name__ == "__main__":