Spaces:
Build error
Build error
Fixed first instance of USER in Intro
#2
by
HughPH
- opened
app.py
CHANGED
|
@@ -151,7 +151,7 @@ def chat(
|
|
| 151 |
username = username.strip()
|
| 152 |
username = username or "USER"
|
| 153 |
|
| 154 |
-
intro = f'''The following is a verbose and detailed conversation between an AI assistant called FRITZ, and a human user called
|
| 155 |
|
| 156 |
{username}: What year was the french revolution?
|
| 157 |
FRITZ: The French Revolution started in 1789, and lasted 10 years until 1799.
|
|
@@ -170,6 +170,7 @@ def chat(
|
|
| 170 |
if len(history) == 0:
|
| 171 |
# no history, so lets reset chat state
|
| 172 |
model.resetState()
|
|
|
|
| 173 |
history = [[], model.emptyState]
|
| 174 |
print("reset chat state")
|
| 175 |
else:
|
|
@@ -208,6 +209,7 @@ def chat(
|
|
| 208 |
|
| 209 |
gc.collect()
|
| 210 |
history[0].append((prompt, generated_text))
|
|
|
|
| 211 |
return history[0], [history[0], out["state"]]
|
| 212 |
|
| 213 |
|
|
|
|
| 151 |
username = username.strip()
|
| 152 |
username = username or "USER"
|
| 153 |
|
| 154 |
+
intro = f'''The following is a verbose and detailed conversation between an AI assistant called FRITZ, and a human user called {username}. FRITZ is intelligent, knowledgeable, wise and polite.
|
| 155 |
|
| 156 |
{username}: What year was the french revolution?
|
| 157 |
FRITZ: The French Revolution started in 1789, and lasted 10 years until 1799.
|
|
|
|
| 170 |
if len(history) == 0:
|
| 171 |
# no history, so lets reset chat state
|
| 172 |
model.resetState()
|
| 173 |
+
# Is it necessary to keep history[0]? We just keep appending to it, and only ever use it to check if the username has changed.
|
| 174 |
history = [[], model.emptyState]
|
| 175 |
print("reset chat state")
|
| 176 |
else:
|
|
|
|
| 209 |
|
| 210 |
gc.collect()
|
| 211 |
history[0].append((prompt, generated_text))
|
| 212 |
+
# Again, history[0] seems redundant. Also, not clear to me why we would want to return it twice?
|
| 213 |
return history[0], [history[0], out["state"]]
|
| 214 |
|
| 215 |
|