Asaad Almutareb commited on
Commit
0eacc0c
1 Parent(s): b41644d

added an avatar to the chat UI

Browse files

removed the tab and added an accordion

Files changed (2) hide show
  1. app.py +14 -6
  2. innovation_pathfinder_ai/avatar.png +0 -0
app.py CHANGED
@@ -1,5 +1,6 @@
1
  from fastapi import FastAPI
2
  import gradio as gr
 
3
  from hf_mixtral_agent import agent_executor
4
  from innovation_pathfinder_ai.source_container.container import (
5
  all_sources
@@ -92,26 +93,33 @@ if __name__ == "__main__":
92
  """
93
 
94
  title = """
95
- <div style="text-align: center;max-width: 700px;">
96
- <p>Hello Dave, how can I help today?<br />
97
  </div>
98
  """
99
 
100
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
101
- with gr.Tab("Google|Wikipedia|Arxiv"):
102
  with gr.Column(elem_id="col-container"):
103
  gr.HTML(title)
104
  with gr.Row():
105
- question = gr.Textbox(label="Question", placeholder="Type your question and hit Enter ")
106
- chatbot = gr.Chatbot([], elem_id="chatbot")
 
 
 
 
107
  chatbot.like(vote, None, None)
108
  clear = gr.Button("Clear")
109
  question.submit(add_text, [chatbot, question], [chatbot, question], queue=False).then(
110
  bot, chatbot, chatbot
111
  )
112
  clear.click(lambda: None, None, chatbot, queue=False)
 
 
113
 
114
- demo.queue().launch(debug=True, share=True)
 
115
 
116
  x = 0 # for debugging purposes
117
  app = gr.mount_gradio_app(app, demo, path="/")
 
1
  from fastapi import FastAPI
2
  import gradio as gr
3
+ from gradio.themes.base import Base
4
  from hf_mixtral_agent import agent_executor
5
  from innovation_pathfinder_ai.source_container.container import (
6
  all_sources
 
93
  """
94
 
95
  title = """
96
+ <div style="text-align: left ;max-width: 700px;">
97
+ <p>Hello Human, I am your AI knowledge research assistant. <br> I can help you research and explore topics across ArXiv, Wikipedia and the internet.<br />
98
  </div>
99
  """
100
 
101
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
102
+ # with gr.Tab("Google|Wikipedia|Arxiv"):
103
  with gr.Column(elem_id="col-container"):
104
  gr.HTML(title)
105
  with gr.Row():
106
+ question = gr.Textbox(label="Question",
107
+ placeholder="Type your question and hit Enter",)
108
+ chatbot = gr.Chatbot([],
109
+ elem_id="AI Assistant",
110
+ bubble_full_width=False,
111
+ avatar_images=(None, (os.path.join(os.path.dirname(__file__), "innovation_pathfinder_ai/avatar.png"))),)
112
  chatbot.like(vote, None, None)
113
  clear = gr.Button("Clear")
114
  question.submit(add_text, [chatbot, question], [chatbot, question], queue=False).then(
115
  bot, chatbot, chatbot
116
  )
117
  clear.click(lambda: None, None, chatbot, queue=False)
118
+ with gr.Accordion("Open for More!", open=False):
119
+ gr.Markdown("Nothing yet...")
120
 
121
+ demo.queue()
122
+ demo.launch(debug=True, share=True)
123
 
124
  x = 0 # for debugging purposes
125
  app = gr.mount_gradio_app(app, demo, path="/")
innovation_pathfinder_ai/avatar.png ADDED