Chrisyichuan commited on
Commit
f1d54eb
Β·
1 Parent(s): 5f60341

elegeant copy

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -127,22 +127,22 @@ with st.sidebar:
127
  # Add example URL and link
128
  example_url = "https://www.google.com/maps/@37.8728123,-122.2445339,3a,75y,3.36h,90t/data=!3m7!1e1!3m5!1s4DTABKOpCL6hdNRgnAHTgw!2e0!6shttps:%2F%2Fstreetviewpixels-pa.googleapis.com%2Fv1%2Fthumbnail%3Fcb_client%3Dmaps_sv.tactile%26w%3D900%26h%3D600%26pitch%3D0%26panoid%3D4DTABKOpCL6hdNRgnAHTgw%26yaw%3D3.3576431!7i13312!8i6656?entry=ttu"
129
 
130
- # Create two columns for the URL input and paste button
131
- url_col1, url_col2 = st.columns([3, 1])
132
 
133
- with url_col1:
134
- google_url = st.text_input(
135
- "Google Maps URL",
136
- placeholder="https://www.google.com/maps/@37.5851338,-122.1519467,9z?entry=ttu"
137
- )
138
 
139
- with url_col2:
140
- if st.button("πŸ“‹ Paste Example", use_container_width=True):
141
- google_url = example_url
142
- st.experimental_rerun()
143
 
144
- # Show the example link
145
- st.markdown(f"πŸ’‘ **Example Location:** [View in Google Maps]({example_url})")
 
 
 
146
 
147
  if google_url:
148
  mapcrunch_url = convert_google_to_mapcrunch_url(google_url)
@@ -160,7 +160,7 @@ with st.sidebar:
160
  st.error("Invalid Google Maps URL format")
161
  st.stop()
162
  else:
163
- st.warning("Please enter a Google Maps URL or click 'Paste Example'")
164
  st.stop()
165
 
166
  model_choice = st.selectbox("Model", list(MODELS_CONFIG.keys()), index=list(MODELS_CONFIG.keys()).index(DEFAULT_MODEL))
 
127
  # Add example URL and link
128
  example_url = "https://www.google.com/maps/@37.8728123,-122.2445339,3a,75y,3.36h,90t/data=!3m7!1e1!3m5!1s4DTABKOpCL6hdNRgnAHTgw!2e0!6shttps:%2F%2Fstreetviewpixels-pa.googleapis.com%2Fv1%2Fthumbnail%3Fcb_client%3Dmaps_sv.tactile%26w%3D900%26h%3D600%26pitch%3D0%26panoid%3D4DTABKOpCL6hdNRgnAHTgw%26yaw%3D3.3576431!7i13312!8i6656?entry=ttu"
129
 
130
+ # Create columns for the example URL display
131
+ example_col1, example_col2 = st.columns([4, 1])
132
 
133
+ with example_col1:
134
+ st.markdown(f"πŸ’‘ **Example Location:** [View in Google Maps]({example_url})")
 
 
 
135
 
136
+ with example_col2:
137
+ if st.button("πŸ“‹ Copy", key="copy_example", use_container_width=True):
138
+ st.write(f'<script>navigator.clipboard.writeText("{example_url}")</script>', unsafe_allow_html=True)
139
+ st.success("Copied!")
140
 
141
+ # URL input
142
+ google_url = st.text_input(
143
+ "Google Maps URL",
144
+ placeholder="https://www.google.com/maps/@37.5851338,-122.1519467,9z?entry=ttu"
145
+ )
146
 
147
  if google_url:
148
  mapcrunch_url = convert_google_to_mapcrunch_url(google_url)
 
160
  st.error("Invalid Google Maps URL format")
161
  st.stop()
162
  else:
163
+ st.warning("Please enter a Google Maps URL")
164
  st.stop()
165
 
166
  model_choice = st.selectbox("Model", list(MODELS_CONFIG.keys()), index=list(MODELS_CONFIG.keys()).index(DEFAULT_MODEL))