Spaces:
Paused
Paused
Commit
·
a074d8f
1
Parent(s):
06a4adc
Updates
Browse files
app.py
CHANGED
|
@@ -45,7 +45,6 @@ class ChatBot:
|
|
| 45 |
self.device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 46 |
self.tokenizer = AutoTokenizer.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat-v1.0", use_fast=False)
|
| 47 |
self.model = AutoModelForCausalLM.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat-v1.0")
|
| 48 |
-
self.model = torch.quantization.quantize_dynamic(self.model, {torch.nn.Linear}, dtype=torch.qint8)
|
| 49 |
|
| 50 |
# Parler-TTS Setup
|
| 51 |
self.tts_model = ParlerTTSForConditionalGeneration.from_pretrained("doublesizebed/parler-tts-mini-malay")
|
|
@@ -65,7 +64,7 @@ class ChatBot:
|
|
| 65 |
"Q: What is photosynthesis?\n"
|
| 66 |
"Answer: Photosynthesis lets plants convert sunlight into energy. Which plants interest you most?\n\n"
|
| 67 |
"Q: How do I make tea?\n"
|
| 68 |
-
"Answer: Steep tea leaves in hot water for 3
|
| 69 |
)
|
| 70 |
# 3) The actual user query
|
| 71 |
query = f"Q: {user_question}\nAnswer:"
|
|
|
|
| 45 |
self.device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 46 |
self.tokenizer = AutoTokenizer.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat-v1.0", use_fast=False)
|
| 47 |
self.model = AutoModelForCausalLM.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat-v1.0")
|
|
|
|
| 48 |
|
| 49 |
# Parler-TTS Setup
|
| 50 |
self.tts_model = ParlerTTSForConditionalGeneration.from_pretrained("doublesizebed/parler-tts-mini-malay")
|
|
|
|
| 64 |
"Q: What is photosynthesis?\n"
|
| 65 |
"Answer: Photosynthesis lets plants convert sunlight into energy. Which plants interest you most?\n\n"
|
| 66 |
"Q: How do I make tea?\n"
|
| 67 |
+
"Answer: Steep tea leaves in hot water for 3-5 minutes, then serve. Do you prefer green or black tea?\n\n"
|
| 68 |
)
|
| 69 |
# 3) The actual user query
|
| 70 |
query = f"Q: {user_question}\nAnswer:"
|