Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -591,30 +591,7 @@ SAFETY_SETTINGS = [
|
|
| 591 |
{"category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_NONE"},
|
| 592 |
]
|
| 593 |
|
| 594 |
-
|
| 595 |
-
st.subheader("Settings")
|
| 596 |
-
temperature = st.slider("Temperature", 0.1, 1.0, generation_config["temperature"])
|
| 597 |
-
top_p = st.slider("Top P", 0.1, 1.0, generation_config["top_p"], 0.01) # Use float step
|
| 598 |
-
top_k = st.slider("Top K", 1, 100, generation_config["top_k"])
|
| 599 |
-
max_output_tokens = st.slider("Max Output Tokens", 100, 5000, generation_config["max_output_tokens"])
|
| 600 |
-
apply_button = st.button("Apply")
|
| 601 |
-
|
| 602 |
-
# Check if the "Apply" button is clicked
|
| 603 |
-
if apply_button:
|
| 604 |
-
# Update generation_config based on user input
|
| 605 |
-
generation_config["temperature"] = temperature
|
| 606 |
-
generation_config["top_p"] = top_p
|
| 607 |
-
generation_config["top_k"] = top_k
|
| 608 |
-
generation_config["max_output_tokens"] = max_output_tokens
|
| 609 |
-
|
| 610 |
-
with st.sidebar:
|
| 611 |
-
st.subheader("Safety Settings")
|
| 612 |
-
for setting in SAFETY_SETTINGS:
|
| 613 |
-
category = setting["category"]
|
| 614 |
-
threshold = st.selectbox(f"{category} Threshold", ["BLOCK_NONE", "BLOCK_LOW_AND_ABOVE", "BLOCK_MID_AND_ABOVE", "BLOCK_HIGH"], index=0)
|
| 615 |
-
|
| 616 |
-
# Update safety settings based on user input
|
| 617 |
-
setting["threshold"] = threshold
|
| 618 |
|
| 619 |
#HEADER
|
| 620 |
st.markdown('''
|
|
@@ -799,7 +776,32 @@ if pdf_mode:
|
|
| 799 |
text_chunks = get_text_chunks(raw_text)
|
| 800 |
get_vector_store(text_chunks)
|
| 801 |
st.success("Done")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 802 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 803 |
if pdf_mode:
|
| 804 |
prompt = None
|
| 805 |
prompty = st.chat_input("Write your questions according to the pdf")
|
|
|
|
| 591 |
{"category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_NONE"},
|
| 592 |
]
|
| 593 |
|
| 594 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 595 |
|
| 596 |
#HEADER
|
| 597 |
st.markdown('''
|
|
|
|
| 776 |
text_chunks = get_text_chunks(raw_text)
|
| 777 |
get_vector_store(text_chunks)
|
| 778 |
st.success("Done")
|
| 779 |
+
else:
|
| 780 |
+
with st.sidebar:
|
| 781 |
+
st.subheader("Settings")
|
| 782 |
+
temperature = st.slider("Temperature", 0.1, 1.0, generation_config["temperature"])
|
| 783 |
+
top_p = st.slider("Top P", 0.1, 1.0, generation_config["top_p"], 0.01) # Use float step
|
| 784 |
+
top_k = st.slider("Top K", 1, 30, generation_config["top_k"])
|
| 785 |
+
max_output_tokens = st.slider("Max Output Tokens", 100, 2048, generation_config["max_output_tokens"])
|
| 786 |
+
apply_button = st.button("Apply")
|
| 787 |
|
| 788 |
+
# Check if the "Apply" button is clicked
|
| 789 |
+
if apply_button:
|
| 790 |
+
# Update generation_config based on user input
|
| 791 |
+
generation_config["temperature"] = temperature
|
| 792 |
+
generation_config["top_p"] = top_p
|
| 793 |
+
generation_config["top_k"] = top_k
|
| 794 |
+
generation_config["max_output_tokens"] = max_output_tokens
|
| 795 |
+
|
| 796 |
+
with st.sidebar:
|
| 797 |
+
st.subheader("Safety Settings")
|
| 798 |
+
for setting in SAFETY_SETTINGS:
|
| 799 |
+
category = setting["category"]
|
| 800 |
+
threshold = st.selectbox(f"{category} Threshold", ["BLOCK_NONE", "BLOCK_ONLY_HIGH", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_LOW_AND_ABOVE"], index=0)
|
| 801 |
+
|
| 802 |
+
# Update safety settings based on user input
|
| 803 |
+
setting["threshold"] = threshold
|
| 804 |
+
|
| 805 |
if pdf_mode:
|
| 806 |
prompt = None
|
| 807 |
prompty = st.chat_input("Write your questions according to the pdf")
|