Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,7 +52,14 @@ def store_message(name: str, message: str):
|
|
| 52 |
)
|
| 53 |
# uncomment line below to begin saving -
|
| 54 |
commit_url = repo.push_to_hub()
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
# main -------------------------
|
| 58 |
mname = "facebook/blenderbot-400M-distill"
|
|
@@ -88,8 +95,8 @@ def chat(message, history):
|
|
| 88 |
history_useful = add_note_to_history(response, history_useful)
|
| 89 |
list_history = history_useful[0].split('</s> <s>')
|
| 90 |
history.append((list_history[-2], list_history[-1]))
|
| 91 |
-
store_message(message, response) # Save to dataset - uncomment if you uncomment above to save inputs and outputs to your dataset
|
| 92 |
-
return history, history
|
| 93 |
|
| 94 |
|
| 95 |
SAMPLE_RATE = 16000
|
|
@@ -129,6 +136,7 @@ gr.Interface(
|
|
| 129 |
outputs=[
|
| 130 |
"textbox",
|
| 131 |
"state",
|
|
|
|
| 132 |
],
|
| 133 |
layout="horizontal",
|
| 134 |
theme="huggingface",
|
|
|
|
| 52 |
)
|
| 53 |
# uncomment line below to begin saving -
|
| 54 |
commit_url = repo.push_to_hub()
|
| 55 |
+
ret = ""
|
| 56 |
+
with open(DATA_FILE, "r") as csvfile:
|
| 57 |
+
reader = csv.DictReader(csvfile)
|
| 58 |
+
|
| 59 |
+
for row in reader:
|
| 60 |
+
ret += row
|
| 61 |
+
ret += "\r\n"
|
| 62 |
+
return ret
|
| 63 |
|
| 64 |
# main -------------------------
|
| 65 |
mname = "facebook/blenderbot-400M-distill"
|
|
|
|
| 95 |
history_useful = add_note_to_history(response, history_useful)
|
| 96 |
list_history = history_useful[0].split('</s> <s>')
|
| 97 |
history.append((list_history[-2], list_history[-1]))
|
| 98 |
+
ret = store_message(message, response) # Save to dataset - uncomment if you uncomment above to save inputs and outputs to your dataset
|
| 99 |
+
return history, history, ret
|
| 100 |
|
| 101 |
|
| 102 |
SAMPLE_RATE = 16000
|
|
|
|
| 136 |
outputs=[
|
| 137 |
"textbox",
|
| 138 |
"state",
|
| 139 |
+
"textbox",
|
| 140 |
],
|
| 141 |
layout="horizontal",
|
| 142 |
theme="huggingface",
|