awacke1 commited on
Commit
6481f63
·
1 Parent(s): 6737fdd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -44,7 +44,8 @@ async def get_df(name: str):
44
  dataset = load_dataset(str, split="train")
45
  return dataset
46
 
47
- async def store_message(name: str, message: str) -> str:
 
48
  if name and message:
49
  with open(DATA_FILE, "a") as csvfile:
50
  writer = csv.DictWriter(csvfile, fieldnames=[ "time", "message", "name", ])
@@ -59,7 +60,8 @@ async def store_message(name: str, message: str) -> str:
59
 
60
  # f=get_df(DATASET_REPO_ID)
61
  # print(f)
62
- return commit_url
 
63
  # ----------------------------------------------- For Memory
64
 
65
  mname = "facebook/blenderbot-400M-distill"
@@ -99,7 +101,8 @@ async def chat(message, history):
99
  history_useful = add_note_to_history(response, history_useful)
100
  list_history = history_useful[0].split('</s> <s>')
101
  history.append((list_history[-2], list_history[-1]))
102
- ret = store_message(message, response) # Save to dataset -- uncomment with code above, create a dataset to store and add your HF_TOKEN from profile to this repo to use.
 
103
  return history, history
104
 
105
  #with gr.Blocks() as demo:
@@ -112,9 +115,10 @@ gr.Interface(
112
  theme="huggingface",
113
  css=".footer {display:none !important}",
114
  inputs=["text", "state"],
115
- outputs=["chatbot", "state", "text"],
 
116
  title=title,
117
  allow_flagging="never",
118
  description=f"Gradio chatbot backed by memory in a dataset repository.",
119
- article=f"The memory dataset for saves is [{DATASET_REPO_URL}]({DATASET_REPO_URL}) 🦃Thanks!🦃 Check out HF Datasets: https://huggingface.co/spaces/awacke1/FreddysDatasetViewer SOTA papers code and datasets on chat are here: https://paperswithcode.com/datasets?q=chat&v=lst&o=newest"
120
  ).launch(debug=True)
 
44
  dataset = load_dataset(str, split="train")
45
  return dataset
46
 
47
+ #def store_message(name: str, message: str) -> str:
48
+ def store_message(name: str, message: str):
49
  if name and message:
50
  with open(DATA_FILE, "a") as csvfile:
51
  writer = csv.DictWriter(csvfile, fieldnames=[ "time", "message", "name", ])
 
60
 
61
  # f=get_df(DATASET_REPO_ID)
62
  # print(f)
63
+ #return commit_url
64
+ return ""
65
  # ----------------------------------------------- For Memory
66
 
67
  mname = "facebook/blenderbot-400M-distill"
 
101
  history_useful = add_note_to_history(response, history_useful)
102
  list_history = history_useful[0].split('</s> <s>')
103
  history.append((list_history[-2], list_history[-1]))
104
+ #ret =
105
+ store_message(message, response) # Save to dataset -- uncomment with code above, create a dataset to store and add your HF_TOKEN from profile to this repo to use.
106
  return history, history
107
 
108
  #with gr.Blocks() as demo:
 
115
  theme="huggingface",
116
  css=".footer {display:none !important}",
117
  inputs=["text", "state"],
118
+ #outputs=["chatbot", "state", "text"],
119
+ outputs=["chatbot", "state"],
120
  title=title,
121
  allow_flagging="never",
122
  description=f"Gradio chatbot backed by memory in a dataset repository.",
123
+ article=f"The memory dataset for saves is [{DATASET_REPO_URL}]({DATASET_REPO_URL}) And here: https://huggingface.co/spaces/awacke1/DatasetAnalyzer Code and datasets on chat are here hf tk: https://paperswithcode.com/datasets?q=chat&v=lst&o=newest"
124
  ).launch(debug=True)