Update app.py
Browse files
app.py
CHANGED
@@ -2,22 +2,13 @@ import gradio as gr
|
|
2 |
import random
|
3 |
from PIL import Image
|
4 |
|
5 |
-
# from funcs import detect_emotions, cosine_distance, generate_triggers_img, process_session
|
6 |
from funcs import detect_emotions, cosine_distance, generate_triggers_img, get_doc_response_emotions, summarize_and_recommend
|
7 |
|
8 |
|
9 |
-
# ps = process_session()
|
10 |
-
|
11 |
-
# img_paths = ['2.jpg','3.jpeg','4.jpeg','5.jpeg','6.jpeg']
|
12 |
-
# img_path = random.choice(img_paths)
|
13 |
-
# img_1 = Image.open(img_path)
|
14 |
-
|
15 |
-
# img_path = '7.jpg'
|
16 |
-
# img_2 = Image.open(img_path)
|
17 |
-
|
18 |
with gr.Blocks() as demo:
|
19 |
gr.Markdown("""# Falcon Cognitive Behavioural Therapy Assistant
|
20 |
-
- Your Personal AI Therapist. Start chatting...""")
|
|
|
21 |
therapy_session_conversation = gr.State([])
|
22 |
|
23 |
img_paths = ['2.jpg','3.jpeg','4.jpeg','5.jpeg','6.jpeg']
|
@@ -39,12 +30,9 @@ with gr.Blocks() as demo:
|
|
39 |
submit_button = gr.Button("Submit")
|
40 |
submit_button.click(get_doc_response_emotions, [user_input, chatbox], [user_input, chatbox, emotions])
|
41 |
user_input.submit(get_doc_response_emotions, [user_input, chatbox], [user_input, chatbox, emotions])
|
42 |
-
# submit_button.click(ps.get_doc_response_emotions, [user_input, chatbox], [user_input, chatbox, emotions])
|
43 |
-
# user_input.submit(ps.get_doc_response_emotions, [user_input, chatbox], [user_input, chatbox, emotions])
|
44 |
recommendations = gr.Textbox(label="Recommended Actions", visible = False)
|
45 |
|
46 |
def summarize_and_recommend_process(tcs):
|
47 |
-
# sn, r = ps.summarize_and_recommend()
|
48 |
sn, r, cb = summarize_and_recommend(tcs)
|
49 |
return gr.update(visible=True, value=sn), gr.update(visible=True, value=r), gr.update(visible=True, value=cb)
|
50 |
|
@@ -53,5 +41,4 @@ with gr.Blocks() as demo:
|
|
53 |
process_button.click(summarize_and_recommend_process, inputs=[chatbox], outputs=[summary_notes, recommendations, chatbox])
|
54 |
|
55 |
|
56 |
-
demo.launch(debug=True, share=True)
|
57 |
-
|
|
|
2 |
import random
|
3 |
from PIL import Image
|
4 |
|
|
|
5 |
from funcs import detect_emotions, cosine_distance, generate_triggers_img, get_doc_response_emotions, summarize_and_recommend
|
6 |
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
with gr.Blocks() as demo:
|
9 |
gr.Markdown("""# Falcon Cognitive Behavioural Therapy Assistant
|
10 |
+
## - Your Personal AI Therapist. Start chatting... Once you finish chatting, click "Generate Session Notes & Recommendations" and wait for few seconds for Summary & Recommndations """)
|
11 |
+
|
12 |
therapy_session_conversation = gr.State([])
|
13 |
|
14 |
img_paths = ['2.jpg','3.jpeg','4.jpeg','5.jpeg','6.jpeg']
|
|
|
30 |
submit_button = gr.Button("Submit")
|
31 |
submit_button.click(get_doc_response_emotions, [user_input, chatbox], [user_input, chatbox, emotions])
|
32 |
user_input.submit(get_doc_response_emotions, [user_input, chatbox], [user_input, chatbox, emotions])
|
|
|
|
|
33 |
recommendations = gr.Textbox(label="Recommended Actions", visible = False)
|
34 |
|
35 |
def summarize_and_recommend_process(tcs):
|
|
|
36 |
sn, r, cb = summarize_and_recommend(tcs)
|
37 |
return gr.update(visible=True, value=sn), gr.update(visible=True, value=r), gr.update(visible=True, value=cb)
|
38 |
|
|
|
41 |
process_button.click(summarize_and_recommend_process, inputs=[chatbox], outputs=[summary_notes, recommendations, chatbox])
|
42 |
|
43 |
|
44 |
+
demo.launch(debug=True, share=True)
|
|