Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from datetime import datetime | |
| # Simple demo logic for exploring Hugging Face Spaces | |
| # Later we can replace this with Whisper + LLM APIs | |
| def analyze_call(user_name, issue_type, customer_message): | |
| timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") | |
| ai_reply = ( | |
| f"Hello {user_name}, thanks for contacting CryptoVoIP support. " | |
| f"I understand your issue is related to '{issue_type}'. " | |
| f"Based on your message: '{customer_message}', our AI suggests checking SIP registration, " | |
| f"network latency, and RTP firewall rules first." | |
| ) | |
| summary = ( | |
| f"Call Summary\n" | |
| f"- Customer: {user_name}\n" | |
| f"- Category: {issue_type}\n" | |
| f"- Time: {timestamp}\n" | |
| f"- Recommended next step: Verify FreeSWITCH logs and RTP media path." | |
| ) | |
| return ai_reply, summary | |
| with gr.Blocks(title="CryptoVoIP AI Support Demo") as demo: | |
| gr.Markdown("# ๐ CryptoVoIP AI Support Demo") | |
| gr.Markdown("Use this as your **first Hugging Face Space** to explore live AI web apps.") | |
| with gr.Row(): | |
| user_name = gr.Textbox(label="Customer Name", placeholder="Enter customer name") | |
| issue_type = gr.Dropdown( | |
| ["SIP Registration", "One-way Audio", "Call Drop", "Video Call", "Billing"], | |
| label="Issue Type" | |
| ) | |
| customer_message = gr.Textbox( | |
| label="Customer Problem", | |
| lines=5, | |
| placeholder="Describe the telecom / VoIP issue..." | |
| ) | |
| run_btn = gr.Button("Analyze with AI") | |
| ai_reply = gr.Textbox(label="AI Suggested Response", lines=4) | |
| summary = gr.Textbox(label="Call Summary", lines=6) | |
| run_btn.click( | |
| fn=analyze_call, | |
| inputs=[user_name, issue_type, customer_message], | |
| outputs=[ai_reply, summary] | |
| ) | |
| demo.launch() | |