Spaces:
Sleeping
Sleeping
Feat: Improve UI
Browse files- .gitignore +1 -0
- app.py +38 -15
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
arxiv-env/
|
app.py
CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
|
|
2 |
from streamlit_extras.no_default_selectbox import selectbox
|
3 |
import pandas as pd
|
4 |
from PIL import Image
|
5 |
-
from random import
|
6 |
import zipfile
|
7 |
import os
|
8 |
|
@@ -25,6 +25,34 @@ def folder_exists(folder_path):
|
|
25 |
return False
|
26 |
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
def unzip_file(zip_file_path: str, modelname: str = model_name):
|
30 |
if not folder_exists(f"models/{modelname}"):
|
@@ -76,36 +104,31 @@ def load_sparse_matrix(path: str):
|
|
76 |
|
77 |
if app_mode == "Generate Recomendations":
|
78 |
welcome_text = """
|
79 |
-
<div style="text-align: justify">Welcome to my paper recommendation project! This App is here to simplify your search for relevant scientific and academic papers.
|
80 |
"""
|
81 |
subjects = """
|
82 |
-
|
83 |
- Mathematics
|
84 |
- Statistics
|
85 |
- Electrical Engineering
|
86 |
- Quantitative Biology
|
87 |
- Economics
|
88 |
|
89 |
-
Say goodbye to information overload and let
|
90 |
"""
|
91 |
st.markdown(welcome_text, unsafe_allow_html=True)
|
92 |
st.markdown(subjects)
|
93 |
st.divider()
|
94 |
|
95 |
|
|
|
96 |
with st.container():
|
97 |
-
examples =
|
98 |
-
|
99 |
-
|
100 |
-
- "Can you recommend papers that explore the use of deep reinforcement learning for autonomous driving, including perception, planning, and control?"
|
101 |
-
- "Could you provide papers on image and video compression algorithms based on the latest video coding standards, such as HEVC and AV1?"
|
102 |
-
- "Can you suggest recent papers on behavioral economics that investigate the role of emotions and biases in decision-making under uncertainty, particularly in the context of financial markets?"
|
103 |
-
|
104 |
-
"""
|
105 |
-
st.markdown(examples)
|
106 |
st.divider()
|
107 |
-
|
108 |
-
|
109 |
with st.spinner('The model binaries are unziping ...'):
|
110 |
zip_file_path = "models/GrammarGuru.zip"
|
111 |
unzip_file(zip_file_path)
|
|
|
2 |
from streamlit_extras.no_default_selectbox import selectbox
|
3 |
import pandas as pd
|
4 |
from PIL import Image
|
5 |
+
from random import choice
|
6 |
import zipfile
|
7 |
import os
|
8 |
|
|
|
25 |
return False
|
26 |
|
27 |
|
28 |
+
def get_random_requests(user_requests_dict, num_elements=5):
|
29 |
+
result_list = []
|
30 |
+
keys = list(user_requests_dict.keys())
|
31 |
+
|
32 |
+
for _ in range(num_elements):
|
33 |
+
random_key = choice(keys)
|
34 |
+
random_value = choice(user_requests_dict[random_key])
|
35 |
+
result_list.append([random_key, random_value])
|
36 |
+
|
37 |
+
return result_list
|
38 |
+
|
39 |
+
def generate_html_table(random_requests):
|
40 |
+
# Start building the HTML table
|
41 |
+
table_html = "<table>"
|
42 |
+
|
43 |
+
# Add the table header
|
44 |
+
table_html += "<tr><th>Category</th><th>Request</th></tr>"
|
45 |
+
|
46 |
+
# Add each row to the table
|
47 |
+
for request in random_requests:
|
48 |
+
category, request_text = request
|
49 |
+
table_html += f"<tr><td>{category}</td><td>{request_text}</td></tr>"
|
50 |
+
|
51 |
+
# Close the table
|
52 |
+
table_html += "</table>"
|
53 |
+
|
54 |
+
return table_html
|
55 |
+
|
56 |
|
57 |
def unzip_file(zip_file_path: str, modelname: str = model_name):
|
58 |
if not folder_exists(f"models/{modelname}"):
|
|
|
104 |
|
105 |
if app_mode == "Generate Recomendations":
|
106 |
welcome_text = """
|
107 |
+
<div style="text-align: justify">Welcome to my paper recommendation project! This App is here to simplify your search for relevant scientific and academic papers. This intelligent recommendation system, powered by <strong>Machine Learning and natural language processing</strong>, analyzes keywords, abstracts, titles, authors, and more to provide personalized suggestions based on your interests. Say goodbye to information overload and let me guide you towards new horizons in your quest for knowledge.
|
108 |
"""
|
109 |
subjects = """
|
110 |
+
This model is trained to recommend papers in various domains, including:
|
111 |
- Mathematics
|
112 |
- Statistics
|
113 |
- Electrical Engineering
|
114 |
- Quantitative Biology
|
115 |
- Economics
|
116 |
|
117 |
+
Say goodbye to information overload and let me guide you towards **new horizons** in your quest for knowledge. Join me and discover a streamlined way to **explore, learn, and stay ahead** in your field. Welcome aboard!
|
118 |
"""
|
119 |
st.markdown(welcome_text, unsafe_allow_html=True)
|
120 |
st.markdown(subjects)
|
121 |
st.divider()
|
122 |
|
123 |
|
124 |
+
st.subheader("Examples")
|
125 |
with st.container():
|
126 |
+
examples = get_random_requests(user_requests_tests)
|
127 |
+
html_table = generate_html_table(examples)
|
128 |
+
st.write(html_table, unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
st.divider()
|
130 |
+
|
131 |
+
|
132 |
with st.spinner('The model binaries are unziping ...'):
|
133 |
zip_file_path = "models/GrammarGuru.zip"
|
134 |
unzip_file(zip_file_path)
|