Spaces:
Sleeping
Sleeping
Commit Β·
9358cf1
1
Parent(s): cf3287c
Moved app.py to the root for Hugging Face deployment
Browse files
app.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from vocca_ai.ai_response import generate_call_summary
|
| 2 |
+
from vocca_ai.intent_classifier import classify_intent
|
| 3 |
+
from vocca_ai.sentiment import analyze_sentiment
|
| 4 |
+
from vocca_ai.db_handler import log_call, fetch_recent_calls
|
| 5 |
+
import streamlit as st
|
| 6 |
+
from vocca_ai.preprocess import priority_score
|
| 7 |
+
from vocca_ai.intent_classifier import classify_intent # Now uses MiniLM
|
| 8 |
+
|
| 9 |
+
import sys
|
| 10 |
+
import os
|
| 11 |
+
|
| 12 |
+
# Ensure Python can find the 'models' directory
|
| 13 |
+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
| 14 |
+
|
| 15 |
+
st.title("π©Ί AI-Powered Call Insights for Vocca")
|
| 16 |
+
st.write("Analyze patient calls, detect urgency, and generate AI-powered responses.")
|
| 17 |
+
|
| 18 |
+
user_input = st.text_area("π Enter Call Transcript:", height=150)
|
| 19 |
+
|
| 20 |
+
if user_input:
|
| 21 |
+
intent = classify_intent(user_input)
|
| 22 |
+
priority = priority_score(user_input)
|
| 23 |
+
sentiment = analyze_sentiment(user_input) # Now using DistilBERT
|
| 24 |
+
ai_response = generate_call_summary(user_input) # Now using Falcon-7B
|
| 25 |
+
|
| 26 |
+
st.subheader("π Extracted Call Insights")
|
| 27 |
+
st.write(f"**Intent:** {intent}")
|
| 28 |
+
st.write(f"**Priority Level:** {priority}")
|
| 29 |
+
st.write(f"**Sentiment:** {sentiment}")
|
| 30 |
+
st.write(f"**AI Suggested Response:** {ai_response}")
|
| 31 |
+
|
| 32 |
+
log_call(user_input, intent, priority, sentiment, ai_response)
|
| 33 |
+
|
| 34 |
+
st.success("β
Call successfully logged & analyzed!")
|
| 35 |
+
|
| 36 |
+
if st.button("π Show Recent Calls"):
|
| 37 |
+
calls = fetch_recent_calls()
|
| 38 |
+
st.subheader("π Recent Call Logs")
|
| 39 |
+
for row in calls:
|
| 40 |
+
st.write(f"π **Transcript:** {row[1]}")
|
| 41 |
+
st.write(f"π **Intent:** {row[2]}, **Priority:** {row[3]}, **Sentiment:** {row[4]}")
|
| 42 |
+
st.write(f"π€ **AI Response:** {row[5]}")
|
| 43 |
+
st.write("---")
|