ogegadavis254 commited on
Commit
31e6f5b
1 Parent(s): 6b6e4db

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -22
app.py CHANGED
@@ -67,8 +67,9 @@ def get_streamed_response(message, history):
67
 
68
  all_message.append({"role": "assistant", "content": entire_assistant_response})
69
 
 
70
  def chat_interface(theme="default"):
71
- with gr.Blocks(theme=getattr(gr.themes, theme, gr.themes.default)) as demo:
72
  gr.Markdown(
73
  """
74
  <h1 style="text-align: center;">Raxder AI Therapist</h1>
@@ -76,34 +77,19 @@ def chat_interface(theme="default"):
76
  """
77
  )
78
  state = gr.State()
79
- chatbot = gr.Chatbot(label="Dave") # Remove the style() call
80
  with gr.Row():
81
- with gr.Column(scale=0.85):
82
  txt = gr.Textbox(
83
  show_label=False,
84
- placeholder="Type your message here...",
85
- ).style(
86
- container=False
87
- ) # Remove the container for better mobile responsiveness
88
- with gr.Column(min_width=50, scale=0.15):
89
  submit = gr.Button("Send", variant="primary")
90
 
91
  submit.click(get_streamed_response, inputs=[txt, state], outputs=[chatbot, state])
92
 
93
- demo.load(
94
- _js="""() => {
95
- document.querySelectorAll(".gr-button").forEach(button => {
96
- button.style.padding = "10px 20px";
97
- button.style.fontSize = "16px";
98
- });
99
- document.querySelectorAll(".gr-textbox").forEach(textbox => {
100
- textbox.style.padding = "10px";
101
- textbox.style.fontSize = "16px";
102
- });
103
- }""",
104
- )
105
-
106
  return demo
107
 
108
  # Launch the Gradio interface
109
- demo = chat_interface(theme="huggingface")
 
67
 
68
  all_message.append({"role": "assistant", "content": entire_assistant_response})
69
 
70
+ # Define a function to render the chat interface
71
  def chat_interface(theme="default"):
72
+ with gr.Blocks(theme=gr.themes.Soft(primary_hue="green")) as demo:
73
  gr.Markdown(
74
  """
75
  <h1 style="text-align: center;">Raxder AI Therapist</h1>
 
77
  """
78
  )
79
  state = gr.State()
80
+ chatbot = gr.Chatbot(label="Dave")
81
  with gr.Row():
82
+ with gr.Column(scale=7):
83
  txt = gr.Textbox(
84
  show_label=False,
85
+ placeholder="Type your message here..."
86
+ )
87
+ with gr.Column(min_width=50, scale=1):
 
 
88
  submit = gr.Button("Send", variant="primary")
89
 
90
  submit.click(get_streamed_response, inputs=[txt, state], outputs=[chatbot, state])
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  return demo
93
 
94
  # Launch the Gradio interface
95
+ demo = chat_interface()