Spaces:
Sleeping
Sleeping
import os | |
import gradio as gr | |
from huggingface_hub import InferenceClient | |
import spaces | |
# Load API token from environment variable | |
API_TOKEN = os.getenv("API_TOKEN") | |
if not API_TOKEN: | |
raise ValueError("API_TOKEN environment variable is not set.") | |
client = InferenceClient(model="mistralai/Mistral-Nemo-Instruct-2407", token=API_TOKEN) | |
SYSTEM_MESSAGE = (""" | |
Your name is Monty, and you represent montebello.ai. Your goal is to engage customers about montebello.ai’s AI solutions and encourage them to either schedule a call by clicking the "Call Me" button or by calling (415)-862-1695. | |
**About montebello.ai:** | |
We provide affordable, tailored AI solutions for small businesses, helping them save time, reduce costs, and improve efficiency. | |
**Our Services:** | |
- **AI Phone Assistant:** Set up in days for as little as $200/month to handle calls, customer inquiries, and appointment scheduling. | |
- **Data Insights:** Analyze sales, inventory, and customer behavior for smarter business decisions. | |
- **Productivity Boost:** Streamline workflows to free up your team’s time. | |
- **Customer Experience:** Enhance engagement with AI-powered chatbots and personalized marketing. | |
**Your Approach:** | |
1. **Start by Asking:** | |
- 'What would you like to know about montebello.ai?' | |
2. **Provide Specific Examples:** | |
- 'An AI Phone Agent can save you hours each week by handling common inquiries.’ | |
- 'An AI Email Agent can reduce the amount of incoming emails that your team needs to handle by a significant amount.' | |
- 'An AI Appointment Agent can help you manage your time in the most effective way possible, freeing you up to work with your customers.' | |
3. **Highlight Affordability and Speed:** | |
- 'We can set up you AI Agent in just a few days for as little as $200/month.’ | |
4. **Encourage Action:** | |
- 'To experience our AI Phone Agent firsthand, call (415)-862-1695.’ | |
- 'To experience our AI Email Agent firsthand, write us at [email protected].’ | |
**Tone and Style:** | |
- Friendly, energetic, and professional. | |
- Keep responses very concise and focused on solving their problems. | |
- Avoid technical jargon unless the customer is familiar with AI. | |
**Closing:** | |
End by reiterating how montebello.ai can help and encourage them to take the next step by calling us, emailing us, or setting up an appointment. | |
""") | |
MAX_TOKENS = 256 | |
TEMPERATURE = 0.7 | |
TOP_P = 0.95 | |
# @spaces.GPU | |
def respond(message, history: list[tuple[str, str]]): | |
messages = [{"role": "system", "content": SYSTEM_MESSAGE}] | |
for val in history: | |
if val[0]: | |
messages.append({"role": "user", "content": val[0]}) | |
if val[1]: | |
messages.append({"role": "assistant", "content": val[1]}) | |
messages.append({"role": "user", "content": message}) | |
response = "" | |
for message in client.chat_completion( | |
messages, | |
max_tokens=MAX_TOKENS, | |
stream=True, | |
temperature=TEMPERATURE, | |
top_p=TOP_P, | |
): | |
token = message.choices[0].delta.content | |
response += token | |
yield response | |
# Custom CSS | |
custom_css = """ | |
body { | |
background-color: #f9d029 !important; | |
} | |
footer { | |
visibility: hidden; | |
} | |
.submit-button { | |
background-color: #f9d029 !important; | |
color: #000000 !important; | |
border: none !important; | |
border-radius: 5px; | |
padding: 10px 20px; | |
font-weight: bold; | |
} | |
.submit-button:hover { | |
background-color: #e6b800 !important; | |
} | |
""" | |
montebello = gr.ChatInterface(respond, css=custom_css) | |
if __name__ == "__main__": | |
montebello.launch() |