Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,6 +27,8 @@ repo = Repository(
|
|
| 27 |
clone_from=DATASET_REPO_URL,
|
| 28 |
use_auth_token=HF_TOKEN)
|
| 29 |
|
|
|
|
|
|
|
| 30 |
|
| 31 |
def generate_text() -> str:
|
| 32 |
with open(DATA_FILE) as file:
|
|
@@ -43,7 +45,7 @@ def store_message(chatinput: str, chatresponse: str):
|
|
| 43 |
if chatinput and chatresponse:
|
| 44 |
with open(DATA_FILE, "a") as file:
|
| 45 |
file.write(f"{datetime.now()},{chatinput},{chatresponse}\n")
|
| 46 |
-
print("
|
| 47 |
return generate_text()
|
| 48 |
|
| 49 |
|
|
@@ -62,6 +64,7 @@ def chatbot(input_text, mentioned_person='Mediator John Haynes'):
|
|
| 62 |
response = index.query(prompt, response_mode="compact")
|
| 63 |
|
| 64 |
store_message(input_text,response)
|
|
|
|
| 65 |
|
| 66 |
# return the response
|
| 67 |
return response.response
|
|
|
|
| 27 |
clone_from=DATASET_REPO_URL,
|
| 28 |
use_auth_token=HF_TOKEN)
|
| 29 |
|
| 30 |
+
print(f"Repo local_dir: {repo.local_dir}")
|
| 31 |
+
print(f"Repo files: {os.listdir(repo.local_dir)}")
|
| 32 |
|
| 33 |
def generate_text() -> str:
|
| 34 |
with open(DATA_FILE) as file:
|
|
|
|
| 45 |
if chatinput and chatresponse:
|
| 46 |
with open(DATA_FILE, "a") as file:
|
| 47 |
file.write(f"{datetime.now()},{chatinput},{chatresponse}\n")
|
| 48 |
+
print(f"Wrote to datafile: {datetime.now()},{chatinput},{chatresponse}\n")
|
| 49 |
return generate_text()
|
| 50 |
|
| 51 |
|
|
|
|
| 64 |
response = index.query(prompt, response_mode="compact")
|
| 65 |
|
| 66 |
store_message(input_text,response)
|
| 67 |
+
print(f"Chat input: {input_text}\nChatbot response: {response.response}")
|
| 68 |
|
| 69 |
# return the response
|
| 70 |
return response.response
|