bezaime commited on
Commit
1a3195c
·
verified ·
1 Parent(s): 9abce9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -15
app.py CHANGED
@@ -69,30 +69,35 @@ rag_chain = (
69
 
70
  import gradio as gr
71
 
 
72
  def rag_memory_stream(message, history):
73
  partial_text = ""
74
  for new_text in rag_chain.stream(message):
75
  partial_text += new_text
76
  yield partial_text
77
 
78
- examples = ['I need a car', 'what is the make and fuel type of a car?']
79
-
80
-
81
-
82
-
83
- description = "Real-time AI App with Groq API and LangChain to Answer medical questions"
84
-
85
-
86
  title = "Car Expert :) Try me!"
87
- demo = gr.ChatInterface(fn=rag_memory_stream,
88
- type="messages",
89
- title=title,
90
- description=description,
91
- fill_height=True,
92
- examples=examples,
93
- theme="glass",
94
  )
95
 
 
 
 
 
 
 
 
 
 
 
96
 
 
97
  if __name__ == "__main__":
98
  demo.launch()
 
69
 
70
  import gradio as gr
71
 
72
+ # Function to process streaming responses
73
  def rag_memory_stream(message, history):
74
  partial_text = ""
75
  for new_text in rag_chain.stream(message):
76
  partial_text += new_text
77
  yield partial_text
78
 
79
+ # Examples and app information
80
+ examples = ['I need a car', 'What is the make and fuel type of a car?']
81
+ description = "Real-time AI App with Groq API and LangChain to Answer car-related questions"
 
 
 
 
 
82
  title = "Car Expert :) Try me!"
83
+
84
+ # Custom theme with black background
85
+ custom_theme = gr.themes.Base(primary_hue="blue", secondary_hue="green").set(
86
+ body_background_fill="#000000", # Black background
87
+ body_text_color="#FFFFFF", # White text for contrast
 
 
88
  )
89
 
90
+ # Gradio interface
91
+ demo = gr.ChatInterface(
92
+ fn=rag_memory_stream,
93
+ type="messages",
94
+ title=title,
95
+ description=description,
96
+ fill_height=True,
97
+ examples=examples,
98
+ theme=custom_theme,
99
+ )
100
 
101
+ # Launch the app
102
  if __name__ == "__main__":
103
  demo.launch()