TogetherAI commited on
Commit
4e660cb
1 Parent(s): 8439d1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -19
app.py CHANGED
@@ -1,9 +1,6 @@
1
  import gradio as gr
2
  from gradio_client import Client
3
 
4
-
5
-
6
-
7
  title = "Llama2 70B Chatbot"
8
  description = """
9
  This Space demonstrates model [Llama-2-70b-chat-hf](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf) by Meta, a Llama 2 model with 70B parameters fine-tuned for chat instructions.
@@ -12,7 +9,6 @@ This Space demonstrates model [Llama-2-70b-chat-hf](https://huggingface.co/meta-
12
  | 7B | [Link](https://huggingface.co/meta-llama/Llama-2-7b) | [Link](https://huggingface.co/meta-llama/Llama-2-7b-hf) | [Link](https://huggingface.co/meta-llama/Llama-2-7b-chat) | [Link](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf) |
13
  | 13B | [Link](https://huggingface.co/meta-llama/Llama-2-13b) | [Link](https://huggingface.co/meta-llama/Llama-2-13b-hf) | [Link](https://huggingface.co/meta-llama/Llama-2-13b-chat) | [Link](https://huggingface.co/meta-llama/Llama-2-13b-chat-hf) |
14
  | 70B | [Link](https://huggingface.co/meta-llama/Llama-2-70b) | [Link](https://huggingface.co/meta-llama/Llama-2-70b-hf) | [Link](https://huggingface.co/meta-llama/Llama-2-70b-chat) | [Link](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf) |
15
-
16
  """
17
  css = """.toast-wrap { display: none !important } """
18
  examples=[
@@ -21,30 +17,25 @@ examples=[
21
  ['Explain the plot of Cinderella in a sentence.'],
22
  ['How many hours does it take a man to eat a Helicopter?'],
23
  ["Write a 100-word article on 'Benefits of Open-Source in AI research'"],
24
- ]
25
-
26
 
27
  # Stream text
28
  def predict(message, chatbot, system_prompt="", temperature=0.9, max_new_tokens=4096):
29
 
30
  client = Client("https://ysharma-explore-llamav2-with-tgi.hf.space/")
31
  return client.predict(
32
- message, # str in 'Message' Textbox component
33
- system_prompt, # str in 'Optional system prompt' Textbox component
34
- temperature, # int | float (numeric value between 0.0 and 1.0)
35
- max_new_tokens, # int | float (numeric value between 0 and 4096)
36
- 0.3, # int | float (numeric value between 0.0 and 1)
37
- 1, # int | float (numeric value between 1.0 and 2.0)
38
- api_name="/chat"
39
  )
40
-
41
-
42
-
43
-
44
 
45
  # Gradio Demo
46
- with gr.Blocks(theme=gr.themes.Base()) as demo:
47
  gr.DuplicateButton()
48
  gr.ChatInterface(predict, title=title, description=description, css=css, examples=examples)
49
 
50
- demo.queue().launch(debug=True)
 
1
  import gradio as gr
2
  from gradio_client import Client
3
 
 
 
 
4
  title = "Llama2 70B Chatbot"
5
  description = """
6
  This Space demonstrates model [Llama-2-70b-chat-hf](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf) by Meta, a Llama 2 model with 70B parameters fine-tuned for chat instructions.
 
9
  | 7B | [Link](https://huggingface.co/meta-llama/Llama-2-7b) | [Link](https://huggingface.co/meta-llama/Llama-2-7b-hf) | [Link](https://huggingface.co/meta-llama/Llama-2-7b-chat) | [Link](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf) |
10
  | 13B | [Link](https://huggingface.co/meta-llama/Llama-2-13b) | [Link](https://huggingface.co/meta-llama/Llama-2-13b-hf) | [Link](https://huggingface.co/meta-llama/Llama-2-13b-chat) | [Link](https://huggingface.co/meta-llama/Llama-2-13b-chat-hf) |
11
  | 70B | [Link](https://huggingface.co/meta-llama/Llama-2-70b) | [Link](https://huggingface.co/meta-llama/Llama-2-70b-hf) | [Link](https://huggingface.co/meta-llama/Llama-2-70b-chat) | [Link](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf) |
 
12
  """
13
  css = """.toast-wrap { display: none !important } """
14
  examples=[
 
17
  ['Explain the plot of Cinderella in a sentence.'],
18
  ['How many hours does it take a man to eat a Helicopter?'],
19
  ["Write a 100-word article on 'Benefits of Open-Source in AI research'"],
20
+ ]
 
21
 
22
  # Stream text
23
  def predict(message, chatbot, system_prompt="", temperature=0.9, max_new_tokens=4096):
24
 
25
  client = Client("https://ysharma-explore-llamav2-with-tgi.hf.space/")
26
  return client.predict(
27
+ message, # str in 'Message' Textbox component
28
+ system_prompt, # str in 'Optional system prompt' Textbox component
29
+ temperature, # int | float (numeric value between 0.0 and 1.0)
30
+ max_new_tokens, # int | float (numeric value between 0 and 4096)
31
+ 0.3, # int | float (numeric value between 0.0 and 1)
32
+ 1, # int | float (numeric value between 1.0 and 2.0)
33
+ api_name="/chat"
34
  )
 
 
 
 
35
 
36
  # Gradio Demo
37
+ with gr.Blocks(theme="ParityError/Interstellar") as demo:
38
  gr.DuplicateButton()
39
  gr.ChatInterface(predict, title=title, description=description, css=css, examples=examples)
40
 
41
+ demo.queue().launch(debug=True)