bezaime commited on
Commit
20d2574
·
verified ·
1 Parent(s): 079dff0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +60 -14
app.py CHANGED
@@ -77,27 +77,73 @@ def rag_memory_stream(message, history):
77
  yield partial_text
78
 
79
  # Examples and app information
80
- examples = ['I need to purchase 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 = "AutoGenius"
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()
 
 
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 = "An advanced chatbot that helps you choose the right car based on your preferences and budget."
82
+ title = "Car Expert :) Let Me Help You Find the Perfect Ride!"
83
 
84
+ # Custom theme with advanced styling
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
+ # Additional UI Components
91
+ with gr.Blocks(theme=custom_theme) as demo:
92
+ gr.Markdown(f"# {title}")
93
+ gr.Markdown(description)
94
+
95
+ with gr.Tabs():
96
+ with gr.Tab("Chat"):
97
+ chat_interface = gr.ChatInterface(
98
+ fn=rag_memory_stream,
99
+ type="messages",
100
+ examples=examples,
101
+ fill_height=True,
102
+ )
103
+
104
+ with gr.Tab("Car Preferences"):
105
+ gr.Markdown("### Provide your preferences to get tailored advice:")
106
+ make = gr.Dropdown(
107
+ choices=["Toyota", "Honda", "BMW", "Tesla", "Ford"],
108
+ label="Preferred Make",
109
+ info="Choose the car manufacturer you prefer.",
110
+ )
111
+ budget = gr.Slider(
112
+ minimum=5000, maximum=100000, step=500,
113
+ label="Budget (in USD)",
114
+ info="Select your budget range.",
115
+ )
116
+ fuel_type = gr.Radio(
117
+ choices=["Gasoline", "Diesel", "Electric", "Hybrid"],
118
+ label="Fuel Type",
119
+ info="Choose the type of fuel you prefer.",
120
+ )
121
+ submit_button = gr.Button("Submit Preferences")
122
+
123
+ with gr.Tab("Upload Documents"):
124
+ gr.Markdown("### Upload any related documents for personalized suggestions:")
125
+ file_upload = gr.File(label="Upload Car Listings or Preferences")
126
+
127
+ with gr.Tab("Help"):
128
+ gr.Markdown("### Need Assistance?")
129
+ gr.Markdown(
130
+ """
131
+ - Use the **Chat** tab to ask questions about cars.
132
+ - Fill in your **Car Preferences** for tailored recommendations.
133
+ - Upload files in the **Upload Documents** tab.
134
+ - Contact support at: [email protected]
135
+ """
136
+ )
137
+
138
+ gr.Markdown("### About")
139
+ gr.Markdown(
140
+ """
141
+ This chatbot is powered by LangChain and Groq API for real-time AI interactions.
142
+ Designed to provide personalized car-buying assistance!
143
+ """
144
+ )
145
 
146
  # Launch the app
147
  if __name__ == "__main__":
148
  demo.launch()
149
+