awacke1 commited on
Commit
58ef439
·
1 Parent(s): 8ccae9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -10
app.py CHANGED
@@ -16,7 +16,7 @@ DATASET_REPO_ID = "awacke1/Carddata.csv"
16
  DATA_FILENAME = "Carddata.csv"
17
  DATA_FILE = os.path.join("data", DATA_FILENAME)
18
  HF_TOKEN = os.environ.get("HF_TOKEN")
19
- # overriding/appending to the gradio template
20
  SCRIPT = """
21
  <script>
22
  if (!window.hasBeenRun) {
@@ -26,8 +26,7 @@ if (!window.hasBeenRun) {
26
  }
27
  </script>
28
  """
29
- #with open(os.path.join(gr.networking.STATIC_TEMPLATE_LIB, "frontend", "index.html"), "a") as f:
30
- # f.write(SCRIPT)
31
  try:
32
  hf_hub_download(
33
  repo_id=DATASET_REPO_ID,
@@ -54,8 +53,6 @@ def generate_html() -> str:
54
  html = "<div class='chatbot'>"
55
  for row in rows:
56
  html += "<div>"
57
- #html += f"<span>{row['name']}</span>"
58
- #html += f"<span class='message'>{row['message']}</span>"
59
  html += f"<span>{row['inputs']}</span>"
60
  html += f"<span class='outputs'>{row['outputs']}</span>"
61
  html += "</div>"
@@ -70,8 +67,8 @@ def store_message(name: str, message: str):
70
  {"name": name, "message": message, "time": str(datetime.now())}
71
  )
72
  commit_url = repo.push_to_hub()
73
- #return generate_html()
74
  return ""
 
75
  iface = gr.Interface(
76
  store_message,
77
  [
@@ -86,8 +83,6 @@ iface = gr.Interface(
86
  description=f"This is a demo of how to do simple *shared data persistence* in a Gradio Space, backed by a dataset repo.",
87
  article=f"The dataset repo is [{DATASET_REPO_URL}]({DATASET_REPO_URL})",
88
  )
89
- #iface.launch()
90
- # -------
91
 
92
 
93
  mname = "facebook/blenderbot-400M-distill"
@@ -109,8 +104,8 @@ def add_note_to_history(note, note_history):
109
  note_history = '</s> <s>'.join(note_history)
110
  return [note_history]
111
 
112
- title = "Blenderbot Tokenizer with Conditional Generation State of the Art"
113
- description = """Blenderbot"""
114
 
115
  def chat(message, history):
116
  history = history or []
 
16
  DATA_FILENAME = "Carddata.csv"
17
  DATA_FILE = os.path.join("data", DATA_FILENAME)
18
  HF_TOKEN = os.environ.get("HF_TOKEN")
19
+
20
  SCRIPT = """
21
  <script>
22
  if (!window.hasBeenRun) {
 
26
  }
27
  </script>
28
  """
29
+
 
30
  try:
31
  hf_hub_download(
32
  repo_id=DATASET_REPO_ID,
 
53
  html = "<div class='chatbot'>"
54
  for row in rows:
55
  html += "<div>"
 
 
56
  html += f"<span>{row['inputs']}</span>"
57
  html += f"<span class='outputs'>{row['outputs']}</span>"
58
  html += "</div>"
 
67
  {"name": name, "message": message, "time": str(datetime.now())}
68
  )
69
  commit_url = repo.push_to_hub()
 
70
  return ""
71
+
72
  iface = gr.Interface(
73
  store_message,
74
  [
 
83
  description=f"This is a demo of how to do simple *shared data persistence* in a Gradio Space, backed by a dataset repo.",
84
  article=f"The dataset repo is [{DATASET_REPO_URL}]({DATASET_REPO_URL})",
85
  )
 
 
86
 
87
 
88
  mname = "facebook/blenderbot-400M-distill"
 
104
  note_history = '</s> <s>'.join(note_history)
105
  return [note_history]
106
 
107
+ title = "Chatbot State of the Art now with Memory Saved to Dataset"
108
+ description = """Chatbot With Memory"""
109
 
110
  def chat(message, history):
111
  history = history or []