eagle0504 commited on
Commit
7a1a80a
·
verified ·
1 Parent(s): 3d158bc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from PIL import Image
3
+
4
+ # Function to handle the form
5
+ def show_form():
6
+ with st.form("name_of_form"):
7
+ st.text_input("Enter text:")
8
+ submitted = st.form_submit_button("Submit")
9
+ if submitted:
10
+ st.write("Form submitted!")
11
+
12
+ # Load and display the image
13
+ image = Image.open("test.jpg")
14
+ st.image(image, caption='Uploaded Image', use_column_width=True)
15
+
16
+ # Define clickable areas (x, y, width, height)
17
+ clickable_areas = [
18
+ {"label": "Area 1", "coords": (100, 100, 50, 50)},
19
+ {"label": "Area 2", "coords": (200, 200, 50, 50)},
20
+ {"label": "Area 3", "coords": (300, 300, 50, 50)}
21
+ ]
22
+
23
+ # Render clickable areas as buttons
24
+ for area in clickable_areas:
25
+ if st.button(area["label"], key=area["label"]):
26
+ show_form()