Spaces:
Running
Running
Chandima Prabhath
commited on
Commit
·
b920265
1
Parent(s):
5e86bf8
Update audio and image directory paths to use temporary directories
Browse files- VoiceReply.py +2 -2
- app.py +2 -2
VoiceReply.py
CHANGED
|
@@ -22,7 +22,7 @@ def generate_voice_reply(prompt, model="openai-audio", voice="coral", audio_dir=
|
|
| 22 |
"""
|
| 23 |
print("DEBUG: Starting generate_voice_reply")
|
| 24 |
print(f"DEBUG: Received prompt: {prompt}")
|
| 25 |
-
|
| 26 |
# Append system prompt to the user's prompt
|
| 27 |
system_prompt = ("Your name is Eve, a WhatsApp bot that can generate images from Flux and help users generate images. "
|
| 28 |
"To generate an image, send a message like: /imagine prompt. Rules: Don't say that you can't send whatsapp messages or generate images. Be friendly and helpful to users. help them with prompts. You can engage in general conversation. ")
|
|
@@ -65,7 +65,7 @@ if __name__ == "__main__":
|
|
| 65 |
# Example usage
|
| 66 |
prompt = "Hi. how are you."
|
| 67 |
audio_dir = "./audio_replies"
|
| 68 |
-
|
| 69 |
|
| 70 |
result = generate_voice_reply(prompt, audio_dir=audio_dir)
|
| 71 |
if result:
|
|
|
|
| 22 |
"""
|
| 23 |
print("DEBUG: Starting generate_voice_reply")
|
| 24 |
print(f"DEBUG: Received prompt: {prompt}")
|
| 25 |
+
os.makedirs(audio_dir, exist_ok=True)
|
| 26 |
# Append system prompt to the user's prompt
|
| 27 |
system_prompt = ("Your name is Eve, a WhatsApp bot that can generate images from Flux and help users generate images. "
|
| 28 |
"To generate an image, send a message like: /imagine prompt. Rules: Don't say that you can't send whatsapp messages or generate images. Be friendly and helpful to users. help them with prompts. You can engage in general conversation. ")
|
|
|
|
| 65 |
# Example usage
|
| 66 |
prompt = "Hi. how are you."
|
| 67 |
audio_dir = "./audio_replies"
|
| 68 |
+
|
| 69 |
|
| 70 |
result = generate_voice_reply(prompt, audio_dir=audio_dir)
|
| 71 |
if result:
|
app.py
CHANGED
|
@@ -17,8 +17,8 @@ GREEN_API_TOKEN = os.getenv("GREEN_API_TOKEN")
|
|
| 17 |
GREEN_API_ID_INSTANCE = os.getenv("GREEN_API_ID_INSTANCE")
|
| 18 |
WEBHOOK_AUTH_TOKEN = os.getenv("WEBHOOK_AUTH_TOKEN")
|
| 19 |
PORT = 7860
|
| 20 |
-
image_dir = "
|
| 21 |
-
audio_dir = "
|
| 22 |
|
| 23 |
if not all([GREEN_API_URL, GREEN_API_TOKEN, GREEN_API_ID_INSTANCE, WEBHOOK_AUTH_TOKEN]):
|
| 24 |
raise ValueError("Environment variables are not set properly")
|
|
|
|
| 17 |
GREEN_API_ID_INSTANCE = os.getenv("GREEN_API_ID_INSTANCE")
|
| 18 |
WEBHOOK_AUTH_TOKEN = os.getenv("WEBHOOK_AUTH_TOKEN")
|
| 19 |
PORT = 7860
|
| 20 |
+
image_dir = "/tmp/images"
|
| 21 |
+
audio_dir = "/tmp/audio"
|
| 22 |
|
| 23 |
if not all([GREEN_API_URL, GREEN_API_TOKEN, GREEN_API_ID_INSTANCE, WEBHOOK_AUTH_TOKEN]):
|
| 24 |
raise ValueError("Environment variables are not set properly")
|