Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,44 +12,48 @@ from langchain.chains.question_answering import load_qa_chain
|
|
12 |
from langchain.callbacks import get_openai_callback
|
13 |
import os
|
14 |
|
15 |
-
|
16 |
-
cloud_button_style = """
|
17 |
-
<style>
|
18 |
-
.cloud-button {
|
19 |
-
display: inline-flex;
|
20 |
-
align-items: center;
|
21 |
-
justify-content: center;
|
22 |
-
padding: 8px 15px;
|
23 |
-
font-size: 14px;
|
24 |
-
cursor: pointer;
|
25 |
-
text-align: center;
|
26 |
-
text-decoration: none;
|
27 |
-
outline: none;
|
28 |
-
color: #fff;
|
29 |
-
background-color: #add8e6;
|
30 |
-
border: none;
|
31 |
-
border-radius: 20px;
|
32 |
-
box-shadow: 0 5px 10px rgba(0,0,0,0.1);
|
33 |
-
margin: 5px;
|
34 |
-
}
|
35 |
-
|
36 |
-
.cloud-button:hover {
|
37 |
-
background-color: #9fced1;
|
38 |
-
}
|
39 |
-
|
40 |
-
.cloud-button:active {
|
41 |
-
background-color: #87b6a7;
|
42 |
-
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
43 |
-
transform: translateY(2px);
|
44 |
-
}
|
45 |
-
</style>
|
46 |
-
"""
|
47 |
-
st.markdown(cloud_button_style, unsafe_allow_html=True)
|
48 |
-
|
49 |
def cloud_button(label, key):
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
st.markdown(button_html, unsafe_allow_html=True)
|
52 |
return st.session_state.get(key, False)
|
|
|
53 |
|
54 |
# Step 1: Clone the Dataset Repository
|
55 |
repo = Repository(
|
@@ -71,7 +75,9 @@ with st.sidebar:
|
|
71 |
|
72 |
add_vertical_space(1) # Adjust as per the desired spacing
|
73 |
|
74 |
-
st.markdown("""
|
|
|
|
|
75 |
Hello! I’m here to assist you with:<br><br>
|
76 |
📘 **Glossary Inquiries:**<br>
|
77 |
I can clarify terms like "DiGA", "AOP", or "BfArM", providing clear and concise explanations to help you understand our content better.<br><br>
|
@@ -158,9 +164,10 @@ def main():
|
|
158 |
query = st.text_input("Ask questions about your PDF file (in any preferred language):")
|
159 |
|
160 |
# Buttons for predefined queries
|
161 |
-
if
|
162 |
query = "Was genau ist ein Belegarzt?"
|
163 |
|
|
|
164 |
if st.button("Wofür wird die Alpha-ID verwendet?", key="button2"):
|
165 |
query = "Wofür wird die Alpha-ID verwendet?"
|
166 |
|
|
|
12 |
from langchain.callbacks import get_openai_callback
|
13 |
import os
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
def cloud_button(label, key):
|
16 |
+
button_id = f"button_{key}"
|
17 |
+
button_html = f"""
|
18 |
+
<style>
|
19 |
+
#{button_id} {{
|
20 |
+
display: inline-flex;
|
21 |
+
align-items: center;
|
22 |
+
justify-content: center;
|
23 |
+
padding: 8px 15px;
|
24 |
+
font-size: 14px;
|
25 |
+
cursor: pointer;
|
26 |
+
text-align: center;
|
27 |
+
text-decoration: none;
|
28 |
+
outline: none;
|
29 |
+
color: #fff;
|
30 |
+
background-color: #add8e6;
|
31 |
+
border: none;
|
32 |
+
border-radius: 20px;
|
33 |
+
box-shadow: 0 5px 10px rgba(0,0,0,0.1);
|
34 |
+
margin: 5px;
|
35 |
+
}}
|
36 |
+
#{button_id}:hover {{
|
37 |
+
background-color: #9fced1;
|
38 |
+
}}
|
39 |
+
#{button_id}:active {{
|
40 |
+
background-color: #87b6a7;
|
41 |
+
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
42 |
+
transform: translateY(2px);
|
43 |
+
}}
|
44 |
+
</style>
|
45 |
+
<button id="{button_id}" class="cloud-button">{label}</button>
|
46 |
+
<script>
|
47 |
+
document.getElementById("{button_id}").onclick = function() {{
|
48 |
+
window.parent.postMessage({{
|
49 |
+
'setSessionState': {{ '{key}': true }}
|
50 |
+
}}, "*");
|
51 |
+
}};
|
52 |
+
</script>
|
53 |
+
|
54 |
st.markdown(button_html, unsafe_allow_html=True)
|
55 |
return st.session_state.get(key, False)
|
56 |
+
|
57 |
|
58 |
# Step 1: Clone the Dataset Repository
|
59 |
repo = Repository(
|
|
|
75 |
|
76 |
add_vertical_space(1) # Adjust as per the desired spacing
|
77 |
|
78 |
+
st.markdown(""")
|
79 |
+
|
80 |
+
|
81 |
Hello! I’m here to assist you with:<br><br>
|
82 |
📘 **Glossary Inquiries:**<br>
|
83 |
I can clarify terms like "DiGA", "AOP", or "BfArM", providing clear and concise explanations to help you understand our content better.<br><br>
|
|
|
164 |
query = st.text_input("Ask questions about your PDF file (in any preferred language):")
|
165 |
|
166 |
# Buttons for predefined queries
|
167 |
+
if cloud_button("Was genau ist ein Belegarzt?", "belegarzt_button"):
|
168 |
query = "Was genau ist ein Belegarzt?"
|
169 |
|
170 |
+
|
171 |
if st.button("Wofür wird die Alpha-ID verwendet?", key="button2"):
|
172 |
query = "Wofür wird die Alpha-ID verwendet?"
|
173 |
|