Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import time
|
| 3 |
+
|
| 4 |
+
def main():
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
llm_models = [
|
| 8 |
+
"db_resnet50",
|
| 9 |
+
"db_resnet34",
|
| 10 |
+
"db_mobilenet_v3_large",
|
| 11 |
+
"linknet_resnet18",
|
| 12 |
+
"linknet_resnet34",
|
| 13 |
+
"linknet_resnet50",
|
| 14 |
+
]
|
| 15 |
+
"""Build a streamlit layout"""
|
| 16 |
+
# Wide mode
|
| 17 |
+
st.set_page_config(layout="wide")
|
| 18 |
+
|
| 19 |
+
# Designing the interface
|
| 20 |
+
st.title("Financial LLM test")
|
| 21 |
+
# For newline
|
| 22 |
+
st.write("\n")
|
| 23 |
+
# Instructions
|
| 24 |
+
st.markdown("*Hint: click on the top-right corner of an image to enlarge it!*")
|
| 25 |
+
# Set the columns
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# Sidebar
|
| 29 |
+
# File selection
|
| 30 |
+
st.sidebar.title("Model selection")
|
| 31 |
+
|
| 32 |
+
# Model selection
|
| 33 |
+
st.sidebar.title("Model selection")
|
| 34 |
+
det_arch = st.sidebar.selectbox("LLM model", llm_models)
|
| 35 |
+
|
| 36 |
+
# For newline
|
| 37 |
+
st.sidebar.write("\n")
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
if st.sidebar.button("Select LLM"):
|
| 41 |
+
time.sleep(5)
|
| 42 |
+
with st.spinner("Loading model..."):
|
| 43 |
+
predictor = load_predictor(
|
| 44 |
+
det_arch, reco_arch, assume_straight_pages, straighten_pages, bin_thresh, forward_device
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
st.markdown("# LLM Notebook")
|
| 48 |
+
text = st.text_area('Prompt:', prompt, placeholder='Please, type your question and submit. ')
|
| 49 |
+
submitted = st.form_submit_button('Submit')
|
| 50 |
+
if submitted:
|
| 51 |
+
time.sleep(4)
|
| 52 |
+
with st.spinner("Analyzing..."):
|
| 53 |
+
st.sidebar.markdown(f" * you are here")
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
if __name__ == "__main__":
|
| 58 |
+
main()
|