SlyFox29 commited on
Commit
4cb2608
1 Parent(s): 478b5dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -44
app.py CHANGED
@@ -11,11 +11,7 @@ HF_TOKEN = os.environ.get("HF_TOKEN", None)
11
 
12
  DESCRIPTION = '''
13
  <div>
14
- <h1 style="text-align: center;">Meta Llama3 8B</h1>
15
- <p>This Space demonstrates the instruction-tuned model <a href="https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct"><b>Meta Llama3 8b Chat</b></a>. Meta Llama3 is the new open LLM and comes in two sizes: 8b and 70b. Feel free to play with it, or duplicate to run privately!</p>
16
- <p>🔎 For more details about the Llama3 release and how to use the model with <code>transformers</code>, take a look <a href="https://huggingface.co/blog/llama3">at our blog post</a>.</p>
17
- <p>🦕 Looking for an even more powerful model? Check out the <a href="https://huggingface.co/chat/"><b>Hugging Chat</b></a> integration for Meta Llama 3 70b</p>
18
- </div>
19
  '''
20
 
21
  LICENSE = """
@@ -28,8 +24,8 @@ Built with Meta Llama 3
28
  PLACEHOLDER = """
29
  <div style="padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center;">
30
  <img src="https://ysharma-dummy-chat-app.hf.space/file=/tmp/gradio/8e75e61cc9bab22b7ce3dec85ab0e6db1da5d107/Meta_lockup_positive%20primary_RGB.jpg" style="width: 80%; max-width: 550px; height: auto; opacity: 0.55; ">
31
- <h1 style="font-size: 28px; margin-bottom: 2px; opacity: 0.55;">Meta llama3</h1>
32
- <p style="font-size: 18px; margin-bottom: 2px; opacity: 0.65;">Ask me anything...</p>
33
  </div>
34
  """
35
 
@@ -49,8 +45,8 @@ h1 {
49
  """
50
 
51
  # Load the tokenizer and model
52
- tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct")
53
- model = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct", device_map="auto") # to("cuda:0")
54
  terminators = [
55
  tokenizer.eos_token_id,
56
  tokenizer.convert_tokens_to_ids("<|eot_id|>")
@@ -106,41 +102,7 @@ def chat_llama3_8b(message: str,
106
  # Gradio block
107
  chatbot=gr.Chatbot(height=450, placeholder=PLACEHOLDER, label='Gradio ChatInterface')
108
 
109
- with gr.Blocks(fill_height=True, css=css) as demo:
110
-
111
- gr.Markdown(DESCRIPTION)
112
- gr.DuplicateButton(value="Duplicate Space for private use", elem_id="duplicate-button")
113
- gr.ChatInterface(
114
- fn=chat_llama3_8b,
115
- chatbot=chatbot,
116
- fill_height=True,
117
- additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False, render=False),
118
- additional_inputs=[
119
- gr.Slider(minimum=0,
120
- maximum=1,
121
- step=0.1,
122
- value=0.95,
123
- label="Temperature",
124
- render=False),
125
- gr.Slider(minimum=128,
126
- maximum=4096,
127
- step=1,
128
- value=512,
129
- label="Max new tokens",
130
- render=False ),
131
- ],
132
- examples=[
133
- ['How to setup a human base on Mars? Give short answer.'],
134
- ['Explain theory of relativity to me like I’m 8 years old.'],
135
- ['What is 9,000 * 9,000?'],
136
- ['Write a pun-filled happy birthday message to my friend Alex.'],
137
- ['Justify why a penguin might make a good king of the jungle.']
138
- ],
139
- cache_examples=False,
140
- )
141
-
142
- gr.Markdown(LICENSE)
143
-
144
  if __name__ == "__main__":
145
  demo.launch()
146
 
 
11
 
12
  DESCRIPTION = '''
13
  <div>
14
+ <h1 style="text-align: center;">Colonial Llama</h1>
 
 
 
 
15
  '''
16
 
17
  LICENSE = """
 
24
  PLACEHOLDER = """
25
  <div style="padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center;">
26
  <img src="https://ysharma-dummy-chat-app.hf.space/file=/tmp/gradio/8e75e61cc9bab22b7ce3dec85ab0e6db1da5d107/Meta_lockup_positive%20primary_RGB.jpg" style="width: 80%; max-width: 550px; height: auto; opacity: 0.55; ">
27
+ <h1 style="font-size: 28px; margin-bottom: 2px; opacity: 0.55;">Freek Llama</h1>
28
+ <p style="font-size: 18px; margin-bottom: 2px; opacity: 0.65;">Ask me anything... Actualy Anything</p>
29
  </div>
30
  """
31
 
 
45
  """
46
 
47
  # Load the tokenizer and model
48
+ tokenizer = AutoTokenizer.from_pretrained("Orenguteng/Llama-3-8B-Lexi-Uncensored")
49
+ model = AutoModelForCausalLM.from_pretrained("Orenguteng/Llama-3-8B-Lexi-Uncensored", device_map="auto") # to("cuda:0")
50
  terminators = [
51
  tokenizer.eos_token_id,
52
  tokenizer.convert_tokens_to_ids("<|eot_id|>")
 
102
  # Gradio block
103
  chatbot=gr.Chatbot(height=450, placeholder=PLACEHOLDER, label='Gradio ChatInterface')
104
 
105
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  if __name__ == "__main__":
107
  demo.launch()
108