datascientist22 commited on
Commit
985d58e
1 Parent(s): 2e84c90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
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
- st.write(response)
 
 
 
 
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