lyimo commited on
Commit
5307f35
·
verified ·
1 Parent(s): 66536af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -49,7 +49,6 @@ def check_authenticity(image):
49
  return f"Image is authentic. Description: {description}"
50
  return "Image is new or modified."
51
 
52
- # Main processing function
53
  def process_image(image, description):
54
  hash_code1 = hash_image(image)
55
  qr_img = generate_qr_code(hash_code1)
@@ -60,7 +59,7 @@ def process_image(image, description):
60
  save_hash(hash_code2)
61
  return image_with_qr, "Image processed and hashes stored."
62
 
63
- # Gradio interface setup
64
  with gr.Blocks() as app:
65
  with gr.Tab("Upload and Process Image"):
66
  with gr.Row():
@@ -68,7 +67,12 @@ with gr.Blocks() as app:
68
  description_input = gr.Textbox(label="Description")
69
  submit_button = gr.Button("Process Image")
70
  image_output = gr.Image(label="Processed Image")
71
- submit_button.click(process_image, inputs=[image_input, description_input], outputs=image_output)
 
 
 
 
 
72
 
73
  with gr.Tab("Check Image Authenticity"):
74
  with gr.Row():
@@ -78,4 +82,4 @@ with gr.Blocks() as app:
78
  check_button.click(check_authenticity, inputs=[image_check_input], outputs=authenticity_output)
79
 
80
  # Launch the application
81
- app.launch()
 
49
  return f"Image is authentic. Description: {description}"
50
  return "Image is new or modified."
51
 
 
52
  def process_image(image, description):
53
  hash_code1 = hash_image(image)
54
  qr_img = generate_qr_code(hash_code1)
 
59
  save_hash(hash_code2)
60
  return image_with_qr, "Image processed and hashes stored."
61
 
62
+ # Update Gradio interface setup to handle the tuple output properly
63
  with gr.Blocks() as app:
64
  with gr.Tab("Upload and Process Image"):
65
  with gr.Row():
 
67
  description_input = gr.Textbox(label="Description")
68
  submit_button = gr.Button("Process Image")
69
  image_output = gr.Image(label="Processed Image")
70
+ message_output = gr.Textbox(label="Status Message")
71
+ submit_button.click(
72
+ process_image,
73
+ inputs=[image_input, description_input],
74
+ outputs=[image_output, message_output]
75
+ )
76
 
77
  with gr.Tab("Check Image Authenticity"):
78
  with gr.Row():
 
82
  check_button.click(check_authenticity, inputs=[image_check_input], outputs=authenticity_output)
83
 
84
  # Launch the application
85
+ app.launch()