Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,10 @@
|
|
1 |
from huggingface_hub import InferenceClient
|
2 |
import gradio as gr
|
|
|
3 |
|
4 |
# Initialize the InferenceClient
|
5 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
6 |
|
7 |
-
#mistralai/Mixtral-8x7B-Instruct-v0.1
|
8 |
-
|
9 |
def format_prompt(message, history):
|
10 |
prompt = "<s>"
|
11 |
for user_prompt, bot_response in history:
|
@@ -28,6 +27,11 @@ def generate(prompt, history, system_prompt, temperature=0.9, max_new_tokens=904
|
|
28 |
seed=42,
|
29 |
)
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
32 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
33 |
output = ""
|
|
|
1 |
from huggingface_hub import InferenceClient
|
2 |
import gradio as gr
|
3 |
+
import datetime
|
4 |
|
5 |
# Initialize the InferenceClient
|
6 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
7 |
|
|
|
|
|
8 |
def format_prompt(message, history):
|
9 |
prompt = "<s>"
|
10 |
for user_prompt, bot_response in history:
|
|
|
27 |
seed=42,
|
28 |
)
|
29 |
|
30 |
+
# Get current time
|
31 |
+
now = datetime.datetime.now()
|
32 |
+
formatted_time = now.strftime("%H.%M.%S, %B, %Y")
|
33 |
+
system_prompt = f"It may not be relevant to you but the exact time is {formatted_time}. please dont mention it unless I specificaly ask for something that is related to that. You dont need to say that you understood, just talk with me liek i didnt tell you this unless i specificaly ask. If i ask if i have given you the current date, you respond with : No, I have acces to it myself. Note, this is the server time, Its probably not my time-zone."
|
34 |
+
|
35 |
formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
36 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
37 |
output = ""
|