FlipTip commited on
Commit
84b2aae
1 Parent(s): 6842b36

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -15
app.py CHANGED
@@ -1,5 +1,6 @@
1
  from huggingface_hub import InferenceClient
2
  import gradio as gr
 
3
  client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
4
 
5
  def format_prompt(message, history, system_prompt):
@@ -11,9 +12,7 @@ def format_prompt(message, history, system_prompt):
11
  prompt += f" [SYSTEM] {system_prompt} [/SYSTEM]"
12
  return prompt
13
 
14
- def generate(
15
- prompt, history, system_prompt, temperature=0.2, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
16
- ):
17
  temperature = float(temperature)
18
  if temperature < 1e-2:
19
  temperature = 1e-2
@@ -34,18 +33,13 @@ def generate(
34
  yield output
35
  return output
36
 
37
- mychatbot = gr.Chatbot(
38
- avatar_images=["./user.png", "./botm.png"],
39
- bubble_full_width=False,
40
- show_label=False,
41
- show_copy_button=True,
42
- likeable=True,
 
43
  )
44
 
45
- demo = gr.Interface(fn=generate,
46
- inputs=[gr.Textbox(lines=2, label="Your Message"), gr.State(), gr.State()],
47
- outputs=[gr.Textbox(label="ChatGPT's Response"), gr.State(), gr.State()],
48
- title="Tomoniai's Mixtral 8x7b Chat",
49
- allow_flagging="never"
50
- )
51
  demo.launch(show_api=False)
 
1
  from huggingface_hub import InferenceClient
2
  import gradio as gr
3
+
4
  client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
5
 
6
  def format_prompt(message, history, system_prompt):
 
12
  prompt += f" [SYSTEM] {system_prompt} [/SYSTEM]"
13
  return prompt
14
 
15
+ def generate(prompt, history, system_prompt, temperature=0.2, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0):
 
 
16
  temperature = float(temperature)
17
  if temperature < 1e-2:
18
  temperature = 1e-2
 
33
  yield output
34
  return output
35
 
36
+ demo = gr.Interface(
37
+ fn=generate,
38
+ inputs=[gr.Textbox(lines=2, label="Your Message"), gr.State()],
39
+ outputs=[gr.Textbox(label="ChatGPT's Response"), gr.State()],
40
+ title="Tomoniai's Mixtral 8x7b Chat",
41
+ allow_flagging="never",
42
+ theme="default"
43
  )
44
 
 
 
 
 
 
 
45
  demo.launch(show_api=False)