Spaces:
Runtime error
Runtime error
Commit
·
e57eac1
1
Parent(s):
f083067
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import requests
|
| 3 |
import datetime
|
|
@@ -45,9 +84,7 @@ memory = ConversationBufferMemory(memory_key="chat_history", return_messages=Tru
|
|
| 45 |
|
| 46 |
|
| 47 |
prompt_template = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
| 48 |
-
|
| 49 |
{context}
|
| 50 |
-
|
| 51 |
Question: {question}"""
|
| 52 |
|
| 53 |
PROMPT = PromptTemplate(
|
|
@@ -69,6 +106,7 @@ context = [] # the context stores a conversation history, you can use this to ma
|
|
| 69 |
while True:
|
| 70 |
if(prompt):
|
| 71 |
st.write(f"{datetime.datetime.now()} :red[{option}:] ", prompt)
|
| 72 |
-
|
| 73 |
|
| 74 |
st.write(f"{datetime.datetime.now()} :red[Bot:] ", context['result'])
|
|
|
|
|
|
| 1 |
+
Hugging Face's logo
|
| 2 |
+
Hugging Face
|
| 3 |
+
Search models, datasets, users...
|
| 4 |
+
Models
|
| 5 |
+
Datasets
|
| 6 |
+
Spaces
|
| 7 |
+
Docs
|
| 8 |
+
Solutions
|
| 9 |
+
Pricing
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
Spaces:
|
| 14 |
+
|
| 15 |
+
IsmaeelPandey
|
| 16 |
+
/
|
| 17 |
+
CodeWars
|
| 18 |
+
|
| 19 |
+
private
|
| 20 |
+
|
| 21 |
+
Logs
|
| 22 |
+
App
|
| 23 |
+
Files
|
| 24 |
+
Community
|
| 25 |
+
Settings
|
| 26 |
+
CodeWars
|
| 27 |
+
/
|
| 28 |
+
app.py
|
| 29 |
+
IsmaeelPandey's picture
|
| 30 |
+
IsmaeelPandey
|
| 31 |
+
Update app.py
|
| 32 |
+
f083067
|
| 33 |
+
less than a minute ago
|
| 34 |
+
raw
|
| 35 |
+
history
|
| 36 |
+
blame
|
| 37 |
+
edit
|
| 38 |
+
delete
|
| 39 |
+
2.5 kB
|
| 40 |
import streamlit as st
|
| 41 |
import requests
|
| 42 |
import datetime
|
|
|
|
| 84 |
|
| 85 |
|
| 86 |
prompt_template = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
|
|
|
| 87 |
{context}
|
|
|
|
| 88 |
Question: {question}"""
|
| 89 |
|
| 90 |
PROMPT = PromptTemplate(
|
|
|
|
| 106 |
while True:
|
| 107 |
if(prompt):
|
| 108 |
st.write(f"{datetime.datetime.now()} :red[{option}:] ", prompt)
|
| 109 |
+
context = qachain({"query": prompt})
|
| 110 |
|
| 111 |
st.write(f"{datetime.datetime.now()} :red[Bot:] ", context['result'])
|
| 112 |
+
|