on1onmangoes commited on
Commit
4bca50c
·
verified ·
1 Parent(s): 6bba7ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -10
app.py CHANGED
@@ -41,21 +41,26 @@ def search_api(query):
41
  def rag_api(question):
42
  return client.predict(question=question, api_name="/answer_with_rag")
43
 
 
 
 
 
 
 
 
 
 
 
44
  # Create the Gradio Blocks interface
45
- with gr.Blocks() as app:
46
- gr.Markdown("### Login")
47
-
48
- with gr.Row():
49
- username_input = gr.Textbox(label="Username", placeholder="Enter your username")
50
- password_input = gr.Textbox(label="Password", placeholder="Enter your password", type="password")
51
-
52
  with gr.Tab("Chat"):
53
- chatbot = gr.Chatbot(fill_height=True) # Create a chatbot interface
54
 
55
  chat_interface = gr.ChatInterface(
56
  fn=stream_chat_with_rag,
57
  chatbot=chatbot,
58
- fill_height=True,
59
  additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False, render=False),
60
  additional_inputs=[
61
  gr.Dropdown(
@@ -162,7 +167,9 @@ with gr.Blocks() as app:
162
  )
163
 
164
  # Launch the app
165
- app.launch()
 
 
166
 
167
 
168
 
 
41
  def rag_api(question):
42
  return client.predict(question=question, api_name="/answer_with_rag")
43
 
44
+ # CSS for custom styling
45
+ CSS = """
46
+ # chat-container {
47
+ height: 100vh;
48
+ }
49
+ """
50
+
51
+ # Title for the application
52
+ TITLE = "<h1 style='text-align:center;'>My Gradio Chat App</h1>"
53
+
54
  # Create the Gradio Blocks interface
55
+ with gr.Blocks(css=CSS) as demo:
56
+ gr.HTML(TITLE)
57
+
 
 
 
 
58
  with gr.Tab("Chat"):
59
+ chatbot = gr.Chatbot() # Create a chatbot interface
60
 
61
  chat_interface = gr.ChatInterface(
62
  fn=stream_chat_with_rag,
63
  chatbot=chatbot,
 
64
  additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False, render=False),
65
  additional_inputs=[
66
  gr.Dropdown(
 
167
  )
168
 
169
  # Launch the app
170
+ if __name__ == "__main__":
171
+ demo.launch()
172
+
173
 
174
 
175