Update to pixeltable 0.7.8 / gradio 5.49: UDFs to udfs.py, model_kwargs, pinned deps, python 3.11
41971b5 Download udfs.py from Pixeltable/Call-Analysis-AI-Tool: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/spaces/Pixeltable/Call-Analysis-AI-Tool/resolve/main/udfs.py
- Command line
-
hf download hf://spaces/Pixeltable/Call-Analysis-AI-Tool/udfs.py
-
curl -L -o udfs.py https://huggingface.co/spaces/Pixeltable/Call-Analysis-AI-Tool/resolve/main/udfs.py
1.1 kB
| import pixeltable as pxt | |
| # Pixeltable rejects @pxt.udf defined in the __main__ script or nested inside | |
| # functions; HF Spaces runs `python app.py`, so UDFs live in this module. | |
| def generate_insights(transcription: str) -> list[dict]: | |
| system_msg = 'You are an AI assistant that analyzes call transcriptions. Analyze the following call transcription and provide insights on: 1. Main topics discussed 2. Action items 3. Sentiment analysis 4. Key questions asked' | |
| user_msg = f'Transcription: "{transcription}"' | |
| return [ | |
| {'role': 'system', 'content': system_msg}, | |
| {'role': 'user', 'content': user_msg}, | |
| ] | |
| def create_chatbot_prompt(context: str, question: str) -> list[dict]: | |
| system_message = "You are an AI assistant that answers questions about a call based on the provided context. If the answer cannot be found in the context, say that you don't know." | |
| user_message = f'Context:\n{context}\n\nQuestion: {question}' | |
| return [ | |
| {'role': 'system', 'content': system_message}, | |
| {'role': 'user', 'content': user_message}, | |
| ] | |