Create pages/reader.py
Browse files- pages/reader.py +39 -0
pages/reader.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Import libraries
|
| 2 |
+
import streamlit as st
|
| 3 |
+
import pandas as pd
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
#===config===
|
| 7 |
+
st.set_page_config(
|
| 8 |
+
page_title="TXTperpus",
|
| 9 |
+
page_icon="https://github.com/faizhalas/Search4All/blob/main/images/logo.png?raw=true",
|
| 10 |
+
layout="wide"
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
# Connect to the Google Sheet
|
| 14 |
+
st.cache_resource(ttl=3600*3)
|
| 15 |
+
def connect_gsheet():
|
| 16 |
+
sheet_id = st.secrets.sheet_id
|
| 17 |
+
sheet_name = st.secrets.sheet_journal
|
| 18 |
+
url = f"https://docs.google.com/spreadsheets/d/{sheet_id}/gviz/tq?tqx=out:csv&sheet={sheet_name}"
|
| 19 |
+
df = pd.read_csv(url, dtype=str, header=0)
|
| 20 |
+
df = df.sort_index(ascending=False).fillna('NaN')
|
| 21 |
+
df["Full-text"] = df[["Abstract (en)", "Introduction", "Method", "Result & Discussion", "Conclusion"]].agg(" - ".join, axis=1)
|
| 22 |
+
return df
|
| 23 |
+
|
| 24 |
+
df = connect_gsheet()
|
| 25 |
+
|
| 26 |
+
st.title('TXTperpus: Reader')
|
| 27 |
+
|
| 28 |
+
paramx = st.query_params["art"]
|
| 29 |
+
st.write(paramx)
|
| 30 |
+
|
| 31 |
+
st.markdown(f"**{row['Title'].strip()}**")
|
| 32 |
+
st.caption(f"**{row['Journal'].strip()}, {row['Volume'].strip()}, {row['Issue'].strip()} - {row['Year'].strip()}**")
|
| 33 |
+
|
| 34 |
+
st.markdown(f"**{row['Authors'].strip()}**")
|
| 35 |
+
st.markdown(f"**{row['Institution'].strip()}**")
|
| 36 |
+
st.markdown(f"**{row['Abstract (en)'].strip()}**")
|
| 37 |
+
st.markdown(f"**{row['Keywords'].strip()}**")
|
| 38 |
+
st.markdown(f"**{row['Introduction'].strip()}**")
|
| 39 |
+
st.markdown(f"**{row['Method'].strip()}**")
|