Pijush2023 commited on
Commit
8e4023e
·
verified ·
1 Parent(s): 5b88da1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -74
app.py CHANGED
@@ -133,17 +133,6 @@ def extract_location_from_response(response):
133
  address_response = agent(response)
134
  return address_response['output']
135
 
136
- # def bot(history, choice):
137
- # if not history:
138
- # return history
139
- # response, addresses = generate_answer(history[-1][0], choice)
140
- # history[-1][1] = ""
141
- # for character in response:
142
- # history[-1][1] += character
143
- # time.sleep(0.05)
144
- # yield history
145
- # if addresses:
146
- # return history, addresses
147
 
148
 
149
  def bot(history, choice):
@@ -508,13 +497,6 @@ def show_map_if_details(history,choice):
508
  else:
509
  return gr.update(visible(False), "")
510
 
511
- # def show_map_if_details(history, choice):
512
- # if choice in ["Details", "Conversational"]:
513
- # addresses = history[-1][2] if len(history[-1]) > 2 else []
514
- # map_html = update_map_with_response(history, addresses)
515
- # return gr.update(visible=True), map_html
516
- # else:
517
- # return gr.update(visible(False), "")
518
 
519
 
520
  def generate_audio_elevenlabs(text):
@@ -563,62 +545,6 @@ def generate_image(prompt):
563
  # Hardcoded prompt for image generation
564
  hardcoded_prompt = "Useing The top events like 'Summer Art Festival' and current time - 4:07 PM ,Date - 06/17/2024 ,Weather-Sunny Bright Day.Create Highly Visually Compelling High Resolution and High Quality Photographics Advatizement for 'Toyota'"
565
 
566
- # with gr.Blocks(theme='rawrsor1/Everforest') as demo:
567
- # with gr.Row():
568
- # chatbot = gr.Chatbot([], elem_id="chatbot", bubble_full_width=False)
569
- # with gr.Column():
570
- # weather_output = gr.HTML(value=fetch_local_weather())
571
-
572
- # with gr.Column():
573
- # news_output = gr.HTML(value=fetch_local_news())
574
-
575
- # def setup_ui():
576
- # state = gr.State()
577
- # with gr.Row():
578
- # with gr.Column():
579
- # gr.Markdown("<h1>Choose the prompt</h1>", elem_id="prompt-markdown")
580
- # choice = gr.Radio(label="Choose a prompt", choices=["Details", "Conversational"], value="Details")
581
- # with gr.Column(): # Larger scale for the right column
582
- # gr.Markdown("<h1>Enter the query / Voice Output</h1>", elem_id="query-markdown")
583
-
584
- # chat_input = gr.Textbox(show_copy_button=True, interactive=True, show_label=False, label="Transcription")
585
- # chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
586
- # bot_msg = chat_msg.then(bot, [chatbot, choice], chatbot, api_name="bot_response")
587
- # bot_msg.then(lambda: gr.Textbox(value="", interactive=True, placeholder="Enter message or upload file...", show_label=False), None, [chat_input])
588
- # chatbot.like(print_like_dislike, None, None)
589
- # clear_button = gr.Button("Clear")
590
- # clear_button.click(fn=clear_textbox, inputs=None, outputs=chat_input)
591
-
592
- # with gr.Column(): # Smaller scale for the left column
593
- # gr.Markdown("<h1>Stream your Voice</h1>", elem_id="voice-markdown")
594
-
595
- # audio_input = gr.Audio(sources=["microphone"], streaming=True, type='numpy')
596
- # audio_input.stream(transcribe_function, inputs=[state, audio_input], outputs=[state, chat_input], api_name="SAMLOne_real_time")
597
-
598
- # with gr.Row():
599
- # with gr.Column():
600
- # gr.Markdown("<h1>Locate the Events</h1>", elem_id="location-markdown")
601
- # location_output = gr.HTML()
602
- # bot_msg.then(show_map_if_details, [chatbot, choice], [location_output, location_output])
603
- # with gr.Column():
604
- # gr.Markdown("<h1>Listen the audio</h1>", elem_id="audio-markdown")
605
- # audio_output = gr.Audio()
606
- # #bot_msg.then(generate_audio_elevenlabs, chatbot, audio_output)
607
- # bot_msg_audio = bot_msg.then(lambda history: generate_audio_elevenlabs(history[-1][1]), chatbot, audio_output)
608
- # with gr.Row():
609
-
610
- # with gr.Column():
611
- # gr.Markdown("<h1>Local Events</h1>", elem_id="events-markdown")
612
- # news_output = gr.HTML(value=fetch_local_events())
613
-
614
- # with gr.Column():
615
- # gr.Markdown("<h1>Generated Image</h1>", elem_id="image-markdown")
616
- # image_output = gr.Image(value=generate_image(hardcoded_prompt))
617
-
618
- # setup_ui()
619
-
620
- # demo.queue()
621
- # demo.launch(share=True)
622
 
623
  with gr.Blocks(theme='rawrsor1/Everforest') as demo:
624
  with gr.Row():
 
133
  address_response = agent(response)
134
  return address_response['output']
135
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
 
138
  def bot(history, choice):
 
497
  else:
498
  return gr.update(visible(False), "")
499
 
 
 
 
 
 
 
 
500
 
501
 
502
  def generate_audio_elevenlabs(text):
 
545
  # Hardcoded prompt for image generation
546
  hardcoded_prompt = "Useing The top events like 'Summer Art Festival' and current time - 4:07 PM ,Date - 06/17/2024 ,Weather-Sunny Bright Day.Create Highly Visually Compelling High Resolution and High Quality Photographics Advatizement for 'Toyota'"
547
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
548
 
549
  with gr.Blocks(theme='rawrsor1/Everforest') as demo:
550
  with gr.Row():