Spaces:
Paused
Paused
Commit
·
b41e7b1
1
Parent(s):
0b0b775
Update app.py (#7)
Browse files- Update app.py (830585afb6e719fa90c9e4a4f295787b44608e75)
app.py
CHANGED
@@ -38,10 +38,10 @@ import requests
|
|
38 |
import os
|
39 |
import gradio as gr
|
40 |
from sentence_transformers import SentenceTransformer, CrossEncoder, util
|
41 |
-
from torch import tensor as torch_tensor
|
42 |
-
from datasets import load_dataset
|
43 |
|
44 |
-
from greg_funcs import mrkl_rspnd
|
45 |
|
46 |
|
47 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
@@ -397,6 +397,7 @@ class ChatWrapper:
|
|
397 |
|
398 |
|
399 |
response = mrkl_rspnd(inp)
|
|
|
400 |
output = response['output']
|
401 |
|
402 |
"""
|
@@ -463,7 +464,7 @@ class ChatWrapper:
|
|
463 |
raise e
|
464 |
finally:
|
465 |
self.lock.release()
|
466 |
-
return history, history, html_video, temp_file, html_audio, temp_aud_file,
|
467 |
# return history, history, html_audio, temp_aud_file, ""
|
468 |
|
469 |
|
@@ -655,7 +656,8 @@ with gr.Blocks(css=CSS) as block:
|
|
655 |
|
656 |
with gr.Column(scale=7):
|
657 |
chatbot = gr.Chatbot()
|
658 |
-
|
|
|
659 |
with gr.Row():
|
660 |
message = gr.Textbox(label="What's on your mind??",
|
661 |
placeholder=PLACEHOLDER,
|
@@ -852,7 +854,7 @@ with gr.Blocks(css=CSS) as block:
|
|
852 |
anticipation_level_state, joy_level_state, trust_level_state, fear_level_state,
|
853 |
surprise_level_state, sadness_level_state, disgust_level_state, anger_level_state,
|
854 |
lang_level_state, translate_to_state, literary_style_state],
|
855 |
-
outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file,
|
856 |
# outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
|
857 |
|
858 |
submit.click(chat, inputs=[message, history_state, chain_state, trace_chain_state,
|
@@ -861,8 +863,8 @@ with gr.Blocks(css=CSS) as block:
|
|
861 |
anticipation_level_state, joy_level_state, trust_level_state, fear_level_state,
|
862 |
surprise_level_state, sadness_level_state, disgust_level_state, anger_level_state,
|
863 |
lang_level_state, translate_to_state, literary_style_state],
|
864 |
-
outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file,
|
865 |
-
|
866 |
|
867 |
|
868 |
block.launch(debug=True)
|
|
|
38 |
import os
|
39 |
import gradio as gr
|
40 |
from sentence_transformers import SentenceTransformer, CrossEncoder, util
|
41 |
+
#from torch import tensor as torch_tensor
|
42 |
+
#from datasets import load_dataset
|
43 |
|
44 |
+
from greg_funcs import mrkl_rspnd, get_cot
|
45 |
|
46 |
|
47 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
|
|
397 |
|
398 |
|
399 |
response = mrkl_rspnd(inp)
|
400 |
+
cot = get_cot(response)
|
401 |
output = response['output']
|
402 |
|
403 |
"""
|
|
|
464 |
raise e
|
465 |
finally:
|
466 |
self.lock.release()
|
467 |
+
return history, history, html_video, temp_file, html_audio, temp_aud_file, cot
|
468 |
# return history, history, html_audio, temp_aud_file, ""
|
469 |
|
470 |
|
|
|
656 |
|
657 |
with gr.Column(scale=7):
|
658 |
chatbot = gr.Chatbot()
|
659 |
+
with gr.Accordion(label='Show AI chain of thought: ', open=False,):
|
660 |
+
ai_cot = gr.HTML(show_label=False)
|
661 |
with gr.Row():
|
662 |
message = gr.Textbox(label="What's on your mind??",
|
663 |
placeholder=PLACEHOLDER,
|
|
|
854 |
anticipation_level_state, joy_level_state, trust_level_state, fear_level_state,
|
855 |
surprise_level_state, sadness_level_state, disgust_level_state, anger_level_state,
|
856 |
lang_level_state, translate_to_state, literary_style_state],
|
857 |
+
outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file, ai_cot])
|
858 |
# outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
|
859 |
|
860 |
submit.click(chat, inputs=[message, history_state, chain_state, trace_chain_state,
|
|
|
863 |
anticipation_level_state, joy_level_state, trust_level_state, fear_level_state,
|
864 |
surprise_level_state, sadness_level_state, disgust_level_state, anger_level_state,
|
865 |
lang_level_state, translate_to_state, literary_style_state],
|
866 |
+
outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file, ai_cot])
|
867 |
+
# history, history, html_video, temp_file, html_audio, temp_aud_file, cot
|
868 |
|
869 |
|
870 |
block.launch(debug=True)
|