Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,17 @@ import os
|
|
6 |
import time
|
7 |
import torch
|
8 |
from random import choice
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
# Configuration
|
11 |
MODEL_NAME = "google/flan-t5-large"
|
@@ -42,7 +53,7 @@ generator = pipeline(
|
|
42 |
device=DEVICE,
|
43 |
torch_dtype=torch.float16
|
44 |
)
|
45 |
-
conversation_memory =
|
46 |
|
47 |
# Voice Functions
|
48 |
def text_to_speech(text):
|
|
|
6 |
import time
|
7 |
import torch
|
8 |
from random import choice
|
9 |
+
# Replace Conversation with custom class
|
10 |
+
class ArkanaMemory:
|
11 |
+
def __init__(self):
|
12 |
+
self.history = []
|
13 |
+
|
14 |
+
def add_exchange(self, user, arkana):
|
15 |
+
self.history.append({
|
16 |
+
"user": user,
|
17 |
+
"arkana": arkana,
|
18 |
+
"timestamp": datetime.now().isoformat()
|
19 |
+
})
|
20 |
|
21 |
# Configuration
|
22 |
MODEL_NAME = "google/flan-t5-large"
|
|
|
53 |
device=DEVICE,
|
54 |
torch_dtype=torch.float16
|
55 |
)
|
56 |
+
conversation_memory = ArkanaMemory()
|
57 |
|
58 |
# Voice Functions
|
59 |
def text_to_speech(text):
|