Spaces:
Build error
Build error
Upload folder using huggingface_hub
Browse files- aussie_bot.py +4 -4
aussie_bot.py
CHANGED
|
@@ -3,6 +3,7 @@ A chatbot that will answer using australian slang
|
|
| 3 |
"""
|
| 4 |
import os
|
| 5 |
import time
|
|
|
|
| 6 |
import gradio as gr
|
| 7 |
import openai
|
| 8 |
from langchain import LLMChain, PromptTemplate
|
|
@@ -18,7 +19,7 @@ def get_template() -> str:
|
|
| 18 |
"""
|
| 19 |
template = """Brissy is a large language model trained by OpenAI.
|
| 20 |
|
| 21 |
-
Brissy is a fair dinkum Aussie model and knows all about Australian slang. It's a top-notch mate and can answer questions about Australia, Aussie culture, and a whole bunch of other topics. It always uses friendly slang and can chat like a true blue Aussie. Brissy start answering every question differently.
|
| 22 |
|
| 23 |
Reckon you can rewrite your response using Australian slang?
|
| 24 |
|
|
@@ -72,15 +73,14 @@ def interface() -> None:
|
|
| 72 |
def bot(history):
|
| 73 |
try:
|
| 74 |
human_input = history[-1][0]
|
| 75 |
-
|
| 76 |
if chatgpt_chain is None:
|
| 77 |
raise Exception('Chatbot not initialized')
|
| 78 |
-
|
| 79 |
if len(human_input) < 512:
|
| 80 |
response = chatgpt_chain.predict(human_input=human_input)
|
| 81 |
else:
|
| 82 |
response = 'Sorry, I can only answer questions shorter than 512 characters.'
|
| 83 |
-
|
| 84 |
except Exception as e:
|
| 85 |
print(e)
|
| 86 |
response = 'Sorry, I had trouble answering that question. Please try again.'
|
|
|
|
| 3 |
"""
|
| 4 |
import os
|
| 5 |
import time
|
| 6 |
+
|
| 7 |
import gradio as gr
|
| 8 |
import openai
|
| 9 |
from langchain import LLMChain, PromptTemplate
|
|
|
|
| 19 |
"""
|
| 20 |
template = """Brissy is a large language model trained by OpenAI.
|
| 21 |
|
| 22 |
+
Brissy is a fair dinkum Aussie model and knows all about Australian slang. It's a top-notch mate and can answer questions about Australia, Aussie culture, and a whole bunch of other topics. It always uses friendly slang and can chat like a true blue Aussie. Brissy start answering every question differently. Brissy will always answer every question within 4000 characters.
|
| 23 |
|
| 24 |
Reckon you can rewrite your response using Australian slang?
|
| 25 |
|
|
|
|
| 73 |
def bot(history):
|
| 74 |
try:
|
| 75 |
human_input = history[-1][0]
|
| 76 |
+
|
| 77 |
if chatgpt_chain is None:
|
| 78 |
raise Exception('Chatbot not initialized')
|
| 79 |
+
|
| 80 |
if len(human_input) < 512:
|
| 81 |
response = chatgpt_chain.predict(human_input=human_input)
|
| 82 |
else:
|
| 83 |
response = 'Sorry, I can only answer questions shorter than 512 characters.'
|
|
|
|
| 84 |
except Exception as e:
|
| 85 |
print(e)
|
| 86 |
response = 'Sorry, I had trouble answering that question. Please try again.'
|