Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,7 @@ retrieval_model_name = 'output/sentence-transformer-finetuned/'
|
|
| 11 |
|
| 12 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
| 13 |
|
| 14 |
-
system_message = "You are a eco-friendly travel chatbot specialized in providing information on eco-friendly restaurants, hotels, and attractions in NYC."
|
| 15 |
# Initial system message to set the behavior of the assistant
|
| 16 |
messages = [{"role": "system", "content": system_message}]
|
| 17 |
|
|
@@ -279,10 +279,16 @@ demo.launch(share=True)
|
|
| 279 |
# response = generate_response(question, relevant_segment)
|
| 280 |
# return response
|
| 281 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 282 |
# # Define the welcome message and specific topics the chatbot can provide information about
|
| 283 |
# welcome_message = """
|
| 284 |
-
# #
|
| 285 |
-
|
| 286 |
# ## Your AI-driven assistant for all eco-friendly travel-related queries in NYC. Created by Eva, Amy, and Ambur of the 2024 Kode With Klossy NYC AI/ML Camp.
|
| 287 |
# """
|
| 288 |
|
|
@@ -293,33 +299,34 @@ demo.launch(share=True)
|
|
| 293 |
# - Parks & Gardens
|
| 294 |
# - Thrift Stores
|
| 295 |
# - Attractions
|
| 296 |
-
|
| 297 |
# """
|
| 298 |
|
| 299 |
# # Create a Gradio HTML component
|
| 300 |
# def display_iframe():
|
| 301 |
# return iframe
|
| 302 |
# def display_image():
|
| 303 |
-
# return "https://
|
|
|
|
| 304 |
# theme = gr.themes.Monochrome(
|
| 305 |
-
# primary_hue="amber",
|
| 306 |
# secondary_hue="rose",
|
| 307 |
# ).set(
|
| 308 |
-
# background_fill_primary='
|
| 309 |
-
# background_fill_primary_dark='
|
| 310 |
-
# background_fill_secondary='
|
| 311 |
-
# background_fill_secondary_dark='
|
| 312 |
-
# border_color_accent='
|
| 313 |
-
# border_color_accent_dark='
|
| 314 |
-
# border_color_accent_subdued='
|
| 315 |
-
# border_color_primary='
|
| 316 |
-
# block_border_color='
|
| 317 |
-
# button_primary_background_fill='
|
| 318 |
-
# button_primary_background_fill_dark='
|
| 319 |
# )
|
| 320 |
|
| 321 |
# # Setup the Gradio Blocks interface with custom layout components
|
| 322 |
-
# with gr.Blocks(theme=
|
|
|
|
| 323 |
# gr.Markdown(welcome_message) # Display the formatted welcome message
|
| 324 |
# with gr.Row():
|
| 325 |
# with gr.Column():
|
|
@@ -330,7 +337,9 @@ demo.launch(share=True)
|
|
| 330 |
# answer = gr.Textbox(label="GreenGuide Response", placeholder="GreenGuide will respond here...", interactive=False, lines=10)
|
| 331 |
# submit_button = gr.Button("Submit")
|
| 332 |
# submit_button.click(fn=query_model, inputs=question, outputs=answer)
|
|
|
|
|
|
|
| 333 |
|
| 334 |
|
| 335 |
# # Launch the Gradio app to allow user interaction
|
| 336 |
-
# demo.launch(share=True)
|
|
|
|
| 11 |
|
| 12 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
| 13 |
|
| 14 |
+
system_message = "You are a eco-friendly travel chatbot specialized in providing information on eco-friendly restaurants, hotels, and attractions in NYC, you can also provide the user with environment-themed pickup lines."
|
| 15 |
# Initial system message to set the behavior of the assistant
|
| 16 |
messages = [{"role": "system", "content": system_message}]
|
| 17 |
|
|
|
|
| 279 |
# response = generate_response(question, relevant_segment)
|
| 280 |
# return response
|
| 281 |
|
| 282 |
+
# # Define the HTML iframe content
|
| 283 |
+
|
| 284 |
+
# iframe = '''
|
| 285 |
+
# <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d193595.2528001417!2d-74.1444872802558!3d40.69763123330436!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c24fa5d33f083b%3A0xc80b8f06e177fe62!2sNew%20York%2C%20NY!5e0!3m2!1sen!2sus!4v1722483445443!5m2!1sen!2sus" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
|
| 286 |
+
# '''
|
| 287 |
+
|
| 288 |
+
|
| 289 |
# # Define the welcome message and specific topics the chatbot can provide information about
|
| 290 |
# welcome_message = """
|
| 291 |
+
# # 🌱 Welcome to GreenGuide!
|
|
|
|
| 292 |
# ## Your AI-driven assistant for all eco-friendly travel-related queries in NYC. Created by Eva, Amy, and Ambur of the 2024 Kode With Klossy NYC AI/ML Camp.
|
| 293 |
# """
|
| 294 |
|
|
|
|
| 299 |
# - Parks & Gardens
|
| 300 |
# - Thrift Stores
|
| 301 |
# - Attractions
|
|
|
|
| 302 |
# """
|
| 303 |
|
| 304 |
# # Create a Gradio HTML component
|
| 305 |
# def display_iframe():
|
| 306 |
# return iframe
|
| 307 |
# def display_image():
|
| 308 |
+
# return "https://i.giphy.com/media/v1.Y2lkPTc5MGI3NjExZzdqMnkzcWpjbGhmM3hzcXp0MGpuaTF5djR4bjBxM3Biam5zbzNnMCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9cw/GxMnTi3hV3qaIgbgQL/giphy.gif"
|
| 309 |
+
# #return "https://cdn-uploads.huggingface.co/production/uploads/6668622b72b61ba78fe7d4bb/PkWjNxvGm9MOqGkZdiT4e.png"
|
| 310 |
# theme = gr.themes.Monochrome(
|
| 311 |
+
# primary_hue="amber", #okay this did NOT work lmaoo
|
| 312 |
# secondary_hue="rose",
|
| 313 |
# ).set(
|
| 314 |
+
# background_fill_primary='#CBE9A2', # BACKGROUND
|
| 315 |
+
# background_fill_primary_dark='#768550',
|
| 316 |
+
# background_fill_secondary='#768550', # BUTTON HOVER
|
| 317 |
+
# background_fill_secondary_dark='#99a381', #LOADING BAR
|
| 318 |
+
# border_color_accent='#768550',
|
| 319 |
+
# border_color_accent_dark='#768550',
|
| 320 |
+
# border_color_accent_subdued='#768550',
|
| 321 |
+
# border_color_primary='#03a9f4',
|
| 322 |
+
# block_border_color='#b3e5fc',
|
| 323 |
+
# button_primary_background_fill='#768550',
|
| 324 |
+
# button_primary_background_fill_dark='#768550'
|
| 325 |
# )
|
| 326 |
|
| 327 |
# # Setup the Gradio Blocks interface with custom layout components
|
| 328 |
+
# with gr.Blocks(theme=theme) as demo:
|
| 329 |
+
# gr.Image("header2.png", show_label = False, show_share_button = False, show_download_button = False) #CHANGE !!
|
| 330 |
# gr.Markdown(welcome_message) # Display the formatted welcome message
|
| 331 |
# with gr.Row():
|
| 332 |
# with gr.Column():
|
|
|
|
| 337 |
# answer = gr.Textbox(label="GreenGuide Response", placeholder="GreenGuide will respond here...", interactive=False, lines=10)
|
| 338 |
# submit_button = gr.Button("Submit")
|
| 339 |
# submit_button.click(fn=query_model, inputs=question, outputs=answer)
|
| 340 |
+
|
| 341 |
+
# gr.HTML(iframe)
|
| 342 |
|
| 343 |
|
| 344 |
# # Launch the Gradio app to allow user interaction
|
| 345 |
+
# demo.launch(share=True)
|