kevinconka commited on
Commit
c259d19
·
1 Parent(s): 273f5f9

Cleaned interface

Browse files
Files changed (1) hide show
  1. app.py +26 -2
app.py CHANGED
@@ -42,11 +42,11 @@ def answer_question(message, history, system):
42
  title = "✨ SEA Dog"
43
  description = """
44
  <p align="center">
45
- I have memorized the entire SEA.AI FAQ page. Ask me anything about it! 🧠
46
  <br>
47
  I can't remember conversations yet, be patient with me.
48
  <br>
49
- DISCLAIMER: Your queries will be saved to
50
  <a href='https://huggingface.co/datasets/SEA-AI/seadog-chat-history'>this dataset</a>
51
  for analytics purposes.
52
  </p>
@@ -61,8 +61,26 @@ h1 {
61
 
62
  theme = gr.themes.Default(primary_hue=gr.themes.colors.indigo)
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  with gr.ChatInterface(
65
  answer_question,
 
66
  title=title,
67
  description=description,
68
  additional_inputs=[gr.Textbox("", label="SYSTEM")],
@@ -70,6 +88,10 @@ with gr.ChatInterface(
70
  ["Can SEA.AI see at night?", "You are a helpful assistant."],
71
  ["Can SEA.AI see at night?", "Reply with sailor slang."],
72
  ],
 
 
 
 
73
  css=css,
74
  theme=theme,
75
  ) as demo:
@@ -77,6 +99,8 @@ with gr.ChatInterface(
77
  demo.load(lambda: download_html(url, filename))
78
  # This needs to be called prior to the first call to callback.flag()
79
  hf_writer.setup([demo.textbox, demo.chatbot], "flagged")
 
 
80
 
81
 
82
  if __name__ == "__main__":
 
42
  title = "✨ SEA Dog"
43
  description = """
44
  <p align="center">
45
+ DISCLAIMERS
46
  <br>
47
  I can't remember conversations yet, be patient with me.
48
  <br>
49
+ Your queries will be saved to
50
  <a href='https://huggingface.co/datasets/SEA-AI/seadog-chat-history'>this dataset</a>
51
  for analytics purposes.
52
  </p>
 
61
 
62
  theme = gr.themes.Default(primary_hue=gr.themes.colors.indigo)
63
 
64
+ chatbot = gr.Chatbot(
65
+ value=[
66
+ [
67
+ None,
68
+ "I have memorized the entire SEA.AI FAQ page. Ask me anything about it! 🧠",
69
+ ],
70
+ ],
71
+ show_label=False,
72
+ show_copy_button=True,
73
+ likeable=True,
74
+ )
75
+
76
+
77
+ def on_like(evt: gr.LikeData):
78
+ print(f"{evt.index=}, {evt.value=}, {evt.liked=}")
79
+
80
+
81
  with gr.ChatInterface(
82
  answer_question,
83
+ chatbot=chatbot,
84
  title=title,
85
  description=description,
86
  additional_inputs=[gr.Textbox("", label="SYSTEM")],
 
88
  ["Can SEA.AI see at night?", "You are a helpful assistant."],
89
  ["Can SEA.AI see at night?", "Reply with sailor slang."],
90
  ],
91
+ submit_btn=None,
92
+ retry_btn=None,
93
+ undo_btn=None,
94
+ clear_btn=None,
95
  css=css,
96
  theme=theme,
97
  ) as demo:
 
99
  demo.load(lambda: download_html(url, filename))
100
  # This needs to be called prior to the first call to callback.flag()
101
  hf_writer.setup([demo.textbox, demo.chatbot], "flagged")
102
+ # like callback
103
+ chatbot.like(on_like, None, None)
104
 
105
 
106
  if __name__ == "__main__":