Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -55,20 +55,25 @@ def recognize_user(image):
|
|
| 55 |
except Exception as e:
|
| 56 |
return f"Error during recognition: {str(e)}"
|
| 57 |
|
| 58 |
-
|
| 59 |
-
with gr.
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
| 66 |
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
|
| 74 |
-
demo.launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
except Exception as e:
|
| 56 |
return f"Error during recognition: {str(e)}"
|
| 57 |
|
| 58 |
+
def main():
|
| 59 |
+
with gr.Blocks() as demo:
|
| 60 |
+
gr.Markdown("Facial Recognition System")
|
| 61 |
+
with gr.Tab("Register"):
|
| 62 |
+
with gr.Row():
|
| 63 |
+
img_register = gr.Image()
|
| 64 |
+
user_id = gr.Textbox(label="User ID")
|
| 65 |
+
register_button = gr.Button("Register")
|
| 66 |
+
register_output = gr.Textbox()
|
| 67 |
+
register_button.click(register_user, inputs=[img_register, user_id], outputs=register_output)
|
| 68 |
|
| 69 |
+
with gr.Tab("Recognize"):
|
| 70 |
+
with gr.Row():
|
| 71 |
+
img_recognize = gr.Image()
|
| 72 |
+
recognize_button = gr.Button("Recognize")
|
| 73 |
+
recognize_output = gr.Textbox()
|
| 74 |
+
recognize_button.click(recognize_user, inputs=[img_recognize], outputs=recognize_output)
|
| 75 |
|
| 76 |
+
demo.launch(share=True)
|
| 77 |
+
|
| 78 |
+
if __name__ == "__main__":
|
| 79 |
+
main()
|