Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
from gradio_client import Client
|
2 |
from huggingface_hub import InferenceClient
|
3 |
-
|
4 |
import gradio as gr
|
|
|
|
|
5 |
ss_client = Client("https://omnibus-html-image-current-tab.hf.space/")
|
6 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
7 |
|
@@ -18,6 +19,16 @@ def format_prompt(message, history):
|
|
18 |
def chat_inf(system_prompt,prompt,history):
|
19 |
if not history:
|
20 |
history = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
22 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
23 |
output = ""
|
|
|
1 |
from gradio_client import Client
|
2 |
from huggingface_hub import InferenceClient
|
|
|
3 |
import gradio as gr
|
4 |
+
import random
|
5 |
+
|
6 |
ss_client = Client("https://omnibus-html-image-current-tab.hf.space/")
|
7 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
8 |
|
|
|
19 |
def chat_inf(system_prompt,prompt,history):
|
20 |
if not history:
|
21 |
history = []
|
22 |
+
seed = random.randint(1,1111111111111111)
|
23 |
+
generate_kwargs = dict(
|
24 |
+
temperature=0.9,
|
25 |
+
max_new_tokens=10480,
|
26 |
+
top_p=0.95,
|
27 |
+
repetition_penalty=1.0,
|
28 |
+
do_sample=True,
|
29 |
+
seed=seed,
|
30 |
+
)
|
31 |
+
|
32 |
formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
33 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
34 |
output = ""
|