neuralleap commited on
Commit
aa08e22
1 Parent(s): 598519d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -18
app.py CHANGED
@@ -17,18 +17,22 @@ HF_TOKEN = os.environ.get("HF_TOKEN", None)
17
 
18
  DESCRIPTION = '''
19
  <div>
20
- <h1 style="text-align: center;">PhysisciaAI</h1>
21
-
 
 
 
22
  '''
23
 
24
  LICENSE = """
25
  <p/>
26
-
27
- Built with Mistral 7B Model
 
28
 
29
  PLACEHOLDER = """
30
  <div style="padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center;">
31
- <img src="https://www.thesmartcityjournal.com/images/Imagenes-Articulos/2023_09_Septiembre/AI_in_healthcare.jpg" style="width: 80%; max-width: 550px; height: auto; opacity: 0.55; ">
32
  <h1 style="font-size: 28px; margin-bottom: 2px; opacity: 0.55;">Meta llama3</h1>
33
  <p style="font-size: 18px; margin-bottom: 2px; opacity: 0.65;">Ask me anything...</p>
34
  </div>
@@ -40,7 +44,6 @@ h1 {
40
  text-align: center;
41
  display: block;
42
  }
43
-
44
  #duplicate-button {
45
  margin: auto;
46
  color: white;
@@ -56,11 +59,6 @@ model = PeftModel.from_pretrained(model, "physician-ai/mistral-finetuned1",use_a
56
  tokenizer = AutoTokenizer.from_pretrained("physician-ai/mistral-finetuned1",use_auth_token=access_token)
57
  text_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=1024, temperature=0.8, top_p=0.95, repetition_penalty=1.15)
58
 
59
- terminators = [
60
- tokenizer.eos_token_id,
61
- tokenizer.convert_tokens_to_ids("<|eot_id|>")
62
- ]
63
-
64
  @spaces.GPU(duration=120)
65
  def chat_llama3_8b(message: str,
66
  history: list,
@@ -135,11 +133,11 @@ with gr.Blocks(fill_height=True, css=css) as demo:
135
  render=False ),
136
  ],
137
  examples=[
138
- ["I've been experiencing persistent headaches, nausea, and sensitivity to light. What could be causing this?"],
139
- ["Based on my diagnosis of type 2 diabetes, what are the recommended treatment options? Should I consider medication, lifestyle changes, or both?"],
140
- ["I'm currently taking lisinopril for hypertension and atorvastatin for high cholesterol. Are there any potential interactions or side effects I should be aware of if I start taking ibuprofen for occasional pain relief?"],
141
- ["I'm in my early 40s and have a family history of heart disease. What are some preventive measures I can take to lower my risk, besides regular exercise and a healthy diet?"],
142
- ["Can you provide information on rheumatoid arthritis, including common symptoms, diagnostic tests, and available treatment options?"]
143
  ],
144
  cache_examples=False,
145
  )
@@ -147,5 +145,4 @@ with gr.Blocks(fill_height=True, css=css) as demo:
147
  gr.Markdown(LICENSE)
148
 
149
  if __name__ == "__main__":
150
- demo.launch()
151
-
 
17
 
18
  DESCRIPTION = '''
19
  <div>
20
+ <h1 style="text-align: center;">Meta Llama3 8B</h1>
21
+ <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>
22
+ <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>
23
+ <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>
24
+ </div>
25
  '''
26
 
27
  LICENSE = """
28
  <p/>
29
+ ---
30
+ Built with Meta Llama 3
31
+ """
32
 
33
  PLACEHOLDER = """
34
  <div style="padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center;">
35
+ <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; ">
36
  <h1 style="font-size: 28px; margin-bottom: 2px; opacity: 0.55;">Meta llama3</h1>
37
  <p style="font-size: 18px; margin-bottom: 2px; opacity: 0.65;">Ask me anything...</p>
38
  </div>
 
44
  text-align: center;
45
  display: block;
46
  }
 
47
  #duplicate-button {
48
  margin: auto;
49
  color: white;
 
59
  tokenizer = AutoTokenizer.from_pretrained("physician-ai/mistral-finetuned1",use_auth_token=access_token)
60
  text_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=1024, temperature=0.8, top_p=0.95, repetition_penalty=1.15)
61
 
 
 
 
 
 
62
  @spaces.GPU(duration=120)
63
  def chat_llama3_8b(message: str,
64
  history: list,
 
133
  render=False ),
134
  ],
135
  examples=[
136
+ ['How to setup a human base on Mars? Give short answer.'],
137
+ ['Explain theory of relativity to me like I’m 8 years old.'],
138
+ ['What is 9,000 * 9,000?'],
139
+ ['Write a pun-filled happy birthday message to my friend Alex.'],
140
+ ['Justify why a penguin might make a good king of the jungle.']
141
  ],
142
  cache_examples=False,
143
  )
 
145
  gr.Markdown(LICENSE)
146
 
147
  if __name__ == "__main__":
148
+ demo.launch()