Nick088 commited on
Commit
0287f0d
·
verified ·
1 Parent(s): 8329725

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -19
app.py CHANGED
@@ -13,14 +13,8 @@ def format_prompt(message, history):
13
  return prompt
14
 
15
  def generate(
16
- prompt, history, system_prompt, max_new_tokens, temperature, repetition_penalty, top_p, top_k, seed,
17
  ):
18
-
19
- temperature = float(temperature)
20
- if temperature < 1e-2:
21
- temperature = 1e-2
22
- top_p = float(top_p)
23
- seed = float(seed)
24
 
25
  if seed == 0:
26
  seed = random.randint(1, 100000)
@@ -37,7 +31,7 @@ def generate(
37
  do_sample=True,
38
  )
39
 
40
- formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
41
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
42
  output = ""
43
 
@@ -48,10 +42,6 @@ def generate(
48
 
49
 
50
  additional_inputs=[
51
- gr.Textbox(
52
- label="System Prompt",
53
- interactive=True,
54
- ),
55
  gr.Slider(
56
  label="Max new tokens",
57
  value=1000,
@@ -105,12 +95,12 @@ additional_inputs=[
105
  ),
106
  ]
107
 
108
- examples=[["I'm planning a vacation to Japan. Can you suggest a one-week itinerary including must-visit places and local cuisines to try?", None, None, None, None, None, None],
109
- ["Can you write a short story about a time-traveling detective who solves historical mysteries?", None, None, None, None, None, None],
110
- ["I'm trying to learn French. Can you provide some common phrases that would be useful for a beginner, along with their pronunciations?", None, None, None, None, None, None],
111
- ["I have chicken, rice, and bell peppers in my kitchen. Can you suggest an easy recipe I can make with these ingredients?", None, None, None, None, None, None],
112
- ["Can you explain how the QuickSort algorithm works and provide a Python implementation?", None, None, None, None, None, None],
113
- ["What are some unique features of Rust that make it stand out compared to other systems programming languages like C++?", None, None, None, None, None, None],
114
  ]
115
 
116
  gr.ChatInterface(
@@ -120,5 +110,4 @@ gr.ChatInterface(
120
  title="Mixtral 8x7b Instruct v0.1",
121
  description="Chatbot Hugging Face space made by [Nick088](https://linktr.ee/Nick088) with costumizable options for model: https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1<br>If you get an erorr, you putted a too much high Max_New_Tokens or your system prompt+prompt is too long, shorten up one of these",
122
  examples=examples,
123
- concurrency_limit=20,
124
  ).launch(show_api=False, share=True)
 
13
  return prompt
14
 
15
  def generate(
16
+ prompt, history, max_new_tokens, temperature, repetition_penalty, top_p, top_k, seed,
17
  ):
 
 
 
 
 
 
18
 
19
  if seed == 0:
20
  seed = random.randint(1, 100000)
 
31
  do_sample=True,
32
  )
33
 
34
+ formatted_prompt = format_prompt(prompt, history)
35
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
36
  output = ""
37
 
 
42
 
43
 
44
  additional_inputs=[
 
 
 
 
45
  gr.Slider(
46
  label="Max new tokens",
47
  value=1000,
 
95
  ),
96
  ]
97
 
98
+ examples=[["I'm planning a vacation to Japan. Can you suggest a one-week itinerary including must-visit places and local cuisines to try?", None, None, None, None, None],
99
+ ["Can you write a short story about a time-traveling detective who solves historical mysteries?", None, None, None, None, None],
100
+ ["I'm trying to learn French. Can you provide some common phrases that would be useful for a beginner, along with their pronunciations?", None, None, None, None, None],
101
+ ["I have chicken, rice, and bell peppers in my kitchen. Can you suggest an easy recipe I can make with these ingredients?", None, None, None, None, None],
102
+ ["Can you explain how the QuickSort algorithm works and provide a Python implementation?", None, None, None, None, None],
103
+ ["What are some unique features of Rust that make it stand out compared to other systems programming languages like C++?", None, None, None, None, None],
104
  ]
105
 
106
  gr.ChatInterface(
 
110
  title="Mixtral 8x7b Instruct v0.1",
111
  description="Chatbot Hugging Face space made by [Nick088](https://linktr.ee/Nick088) with costumizable options for model: https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1<br>If you get an erorr, you putted a too much high Max_New_Tokens or your system prompt+prompt is too long, shorten up one of these",
112
  examples=examples,
 
113
  ).launch(show_api=False, share=True)