SiddhantSadangi / st_supabase_connection

An easy-to-use Supabase connector for Streamlit that caches your API calls to make querying fast and cheap.
https://pypi.org/project/st-supabase-connection/
MIT License
91 stars 12 forks source link

TypeError: 'type' object is not subscriptable #8

Closed 0xSaurabhx closed 9 months ago

0xSaurabhx commented 9 months ago
Traceback (most recent call last):
  File "/home/saurabh/.local/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script
    exec(code, module.__dict__)
  File "/home/saurabh/Documents/advAIta/new.py", line 4, in <module>
    from st_supabase_connection import SupabaseConnection
  File "/home/saurabh/.local/lib/python3.8/site-packages/st_supabase_connection/__init__.py", line 17, in <module>
    class SupabaseConnection(BaseConnection[Client]):
  File "/home/saurabh/.local/lib/python3.8/site-packages/st_supabase_connection/__init__.py", line 141, in SupabaseConnection
    allowed_mime_types: Optional[list[str]] = None,
TypeError: 'type' object is not subscriptable

my code:

import streamlit as st
import pandas as pd
import re
from st_supabase_connection import SupabaseConnection
st_supabase_client = st.connection(
                    name="supabase_connection",
                    type=SupabaseConnection,
                    ttl=None,
                    url="some url", 
                    key="some key"
                )
df = pd.read_csv("fresh.csv")
df = df.iloc[::-1] 

st.set_page_config(page_title="advAIta", layout="wide")

for index, row in df.iterrows():
    st.title(f"{row['Title']}")
    st.write(f"{row['Description']}")
    st.write(f"Date: {row['Date']} - Bailurmath")
    st.write(f"Duration: {row['Duration']} - Bailurmath")

    video_id = re.findall(r"(?<=v=)[\w-]+|(?<=be/)[\w-]+", row["Link"])[0]
    embed_url = f"https://www.youtube.com/embed/{video_id}"

    if st.button(f"View {row['Title']}", key=index):
        col1, col2, col3 = st.columns(3)
        with col1:
            st.header("Video")
            st.video(embed_url)
        with col2:
            st.title("Info")
            st.write(f"Date: {row['Date']}")
            st.write(f"Channel Name: Bailurmath")
            st.write(f"Duration: {row['Duration']}")
            text_input = st.text_input("Enter feedback here")
            if st.button("Submit"):
                st_supabase_client.table("user_inputs").insert([{"text":"{text_input}"}], count="None").execute()
        with col3:
            st.header("Summary")
            st.write(row["Summary"])
SiddhantSadangi commented 9 months ago

Hey @0xSaurabhx 👋 Thanks for bringing this to my notice 🤗

I've released a fix in v1.2.2 🚀

Could you please update st_supabase_connection to 1.2.2 and let me know if it works for you?

0xSaurabhx commented 6 months ago

works fine now