Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -41,12 +41,10 @@ if st.sidebar.button("Submit"):
|
|
41 |
|
42 |
# Define the prompt format for the model
|
43 |
prompt = """
|
44 |
-
### Instruction and Input:
|
45 |
-
Based on the following context/document:
|
46 |
{}
|
|
|
47 |
Please answer the question: {}
|
48 |
|
49 |
-
### Response:
|
50 |
{}
|
51 |
"""
|
52 |
|
@@ -69,7 +67,11 @@ if st.sidebar.button("Submit"):
|
|
69 |
|
70 |
# Decode and display the results
|
71 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
72 |
-
|
|
|
|
|
|
|
|
|
73 |
else:
|
74 |
st.sidebar.error("Please upload a PDF file and enter a query.")
|
75 |
|
|
|
41 |
|
42 |
# Define the prompt format for the model
|
43 |
prompt = """
|
|
|
|
|
44 |
{}
|
45 |
+
|
46 |
Please answer the question: {}
|
47 |
|
|
|
48 |
{}
|
49 |
"""
|
50 |
|
|
|
67 |
|
68 |
# Decode and display the results
|
69 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
70 |
+
|
71 |
+
# Remove unwanted text fields from the response
|
72 |
+
clean_response = response.replace("### Instruction and Input:", "").replace("### Response:", "").strip()
|
73 |
+
|
74 |
+
st.write(clean_response)
|
75 |
else:
|
76 |
st.sidebar.error("Please upload a PDF file and enter a query.")
|
77 |
|