File size: 1,674 Bytes
9358cf1
 
 
 
 
 
20d97e8
 
 
9358cf1
 
 
 
21f0ec0
9358cf1
 
 
 
 
a285c44
9358cf1
 
 
 
 
 
 
21f0ec0
9358cf1
 
 
 
 
 
 
 
 
 
 
 
 
21f0ec0
 
 
9358cf1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from vocca_ai.ai_response import generate_call_summary
from vocca_ai.intent_classifier import classify_intent
from vocca_ai.sentiment import analyze_sentiment
from vocca_ai.db_handler import log_call, fetch_recent_calls
import streamlit as st
from vocca_ai.preprocess import priority_score
from vocca_ai.intent_classifier import classify_intent 



import sys
import os

# this line ensures Python can find the 'models' directory
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))

st.title("🩺 AI-Powered Call Insights for Vocca")
st.write("Analyze patient calls, detect urgency, and generate AI-powered responses.")

user_input = st.text_area("πŸ“ž Enter Call Transcript:", height=250)

if user_input:
    intent = classify_intent(user_input)
    priority = priority_score(user_input)
    sentiment = analyze_sentiment(user_input)  # Now using DistilBERT
    ai_response = generate_call_summary(user_input)  # Now using Falcon-7B

    st.subheader(" Extracted Call Insights")
    st.write(f"**Intent:** {intent}")
    st.write(f"**Priority Level:** {priority}")
    st.write(f"**Sentiment:** {sentiment}")
    st.write(f"**AI Suggested Response:** {ai_response}")

    log_call(user_input, intent, priority, sentiment, ai_response)

    st.success("βœ… Call successfully logged & analyzed!")

if st.button("πŸ“Š Show Recent Calls"):
    calls = fetch_recent_calls()
    st.subheader("πŸ“Š Recent Call Logs")
    for row in calls:
        st.write(f" **Transcript:** {row[1]}")
        st.write(f" **Intent:** {row[2]}, **Priority:** {row[3]}, **Sentiment:** {row[4]}")
        st.write(f" **AI Response:** {row[5]}")
        st.write("---")