Deploy geography stremalit app

Hi. I am trying to deploy my interactive app for my students.
During my deployment I encountered
sqlalchemy.exc.NoSuchModuleError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).
I am using leafmap for creating map and sqlalchemy for accessing google spreadsheets

My code:

'import streamlit as st
import pandas as pd
import requests
import sqlalchemy
import matplotlib.pyplot as plt
import leafmap.foliumap as leafmap
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy import text

st.set_page_config(page_title=‘’, layout=‘wide’)

st.title(‘Интерактивна карта’)
st.markdown(‘Това е вашият интерактивен час’)

address = st.text_input('Местоположение: ')

ORS_API_KEY = st.secrets[‘ORS_API_KEY’]

@st.cache
def geocode(query):
parameters = {‘api_key’: ORS_API_KEY, ‘text’: query}

response = requests.get('https://api.openrouteservice.org/geocode/search', params=parameters)
if response.status_code == 200:
    data = response.json()
    if data['features']:
        x, y = data['features'][0]['geometry']['coordinates']
        return (y, x)

legend_dict = {
‘Tree cover’: ‘006400’,
‘Shrubland’: ‘ffbb22’,
‘Grassland’: ‘ffff4c’,
‘Cropland’: ‘f096ff’,
‘Built-up’: ‘fa0000’,
'Bare, sparse vegetation ': ‘b4b4b4’,
‘Snow and ice’: ‘f0f0f0’,
‘Permanent water bodies’: ‘0064c8’,
‘Herbaceous wetland’: ‘0096a0’,
‘Mangroves’: ‘00cf75’,
‘Moss and lichen’: ‘fae6a0’
}
result =
if address:
results = geocode(address)
result.append(results)
if results:
st.write(‘Geocoded Coordinates: {}, {}’.format(results[0], results[1]))

    m = leafmap.Map(location=results, layers_control=True, draw_control=False, measure_control=True, fullscreen_control=True, zoom=10)
    m.add_wms_layer(url = "https://services.terrascope.be/wms/v2", layers = "WORLDCOVER_2020_MAP", name = "ESA Worldcover 2020", format = "image/png", shown=True)
    m.add_legend(title='NLCD Land Cover Classification', legend_dict=legend_dict)
    m.add_marker(location=results, popup=address)
    m_streamlit = m.to_streamlit(800, 800)
else:
    st.error('Request failed. No results.')

engine = create_engine(“gsheets://”, service_account_file=st.secrets[‘gcp_service_account’],
catalog=
{“my_sheet”: “my_sheet - Google Sheets”,
“new_sheet”: “my_sheet - Google Sheets”,
“corine”: “my_sheet - Google Sheets”,
“interactive_class”: “my_sheet - Google Sheets”},)

base = declarative_base()
class My_object(base):
tablename = ‘interactive_class’
name = Column(String, primary_key=True)
address = Column(String)
temperature = Column(Integer)
date = Column(String)

mine = sessionmaker(bind=engine)
session = mine()

options_form = st.sidebar.form(‘options_form’)
name1 = options_form.text_input(‘Име’)
address1 = options_form.text_input(‘Адрес’)
temperature1 = options_form.number_input(‘Температура’, min_value=-20.0, max_value=40.0, step=1.0)
date1 = options_form.date_input(‘Дата’)

add_data = options_form.form_submit_button()

if add_data:
new_rec = My_object(name=name1, address=address1, temperature=temperature1, date=date1)
session.add(new_rec)
session.commit()’

I also want to understand is there any specifications about using streamlit on android.

Hi there,

Thanks for sharing your question with the community! Check out our guidelines on how to post an effective question here – in particular, please be sure to format your code properly so we can try to figure out where the issue is

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.