awacke1 commited on
Commit
0b90857
Β·
1 Parent(s): a93d5fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -5
app.py CHANGED
@@ -5,7 +5,6 @@ client = InferenceClient(
5
  "mistralai/Mistral-7B-Instruct-v0.1"
6
  )
7
 
8
-
9
  def format_prompt(message, history):
10
  prompt = "<s>"
11
  for user_prompt, bot_response in history:
@@ -32,7 +31,7 @@ def generate(
32
  )
33
 
34
  formatted_prompt = format_prompt(prompt, history)
35
-
36
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
37
  output = ""
38
 
@@ -41,7 +40,6 @@ def generate(
41
  yield output
42
  return output
43
 
44
-
45
  additional_inputs=[
46
  gr.Slider(
47
  label="Temperature",
@@ -93,10 +91,36 @@ with gr.Blocks(css=css) as demo:
93
  gr.HTML("<h1><center>Mistral 7B Instruct<h1><center>")
94
  gr.HTML("<h3><center>In this demo, you can chat with <a href='https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1'>Mistral-7B-Instruct</a> model. πŸ’¬<h3><center>")
95
  gr.HTML("<h3><center>Learn more about the model <a href='https://huggingface.co/docs/transformers/main/model_doc/mistral'>here</a>. πŸ“š<h3><center>")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  gr.ChatInterface(
97
  generate,
98
  additional_inputs=additional_inputs,
99
- examples=[["What is the secret to life?"], ["Write me a recipe for pancakes."]]
100
  )
101
 
102
- demo.queue().launch(debug=True)
 
5
  "mistralai/Mistral-7B-Instruct-v0.1"
6
  )
7
 
 
8
  def format_prompt(message, history):
9
  prompt = "<s>"
10
  for user_prompt, bot_response in history:
 
31
  )
32
 
33
  formatted_prompt = format_prompt(prompt, history)
34
+
35
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
36
  output = ""
37
 
 
40
  yield output
41
  return output
42
 
 
43
  additional_inputs=[
44
  gr.Slider(
45
  label="Temperature",
 
91
  gr.HTML("<h1><center>Mistral 7B Instruct<h1><center>")
92
  gr.HTML("<h3><center>In this demo, you can chat with <a href='https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1'>Mistral-7B-Instruct</a> model. πŸ’¬<h3><center>")
93
  gr.HTML("<h3><center>Learn more about the model <a href='https://huggingface.co/docs/transformers/main/model_doc/mistral'>here</a>. πŸ“š<h3><center>")
94
+
95
+ #example_questions = [
96
+ # "Create a ten-point markdown outline with emojis about: Decreased Ξ±-ketoglutarate dehydrogenase activity in astrocytes",
97
+ # "Create a ten-point markdown outline with emojis about: Lewy body dementia",
98
+ # # ... Add more example questions here
99
+ # "Create a ten-point markdown outline with emojis about: Delusional disorder",
100
+ # "Create a ten-point markdown outline with emojis about: Galantamine"
101
+ #]
102
+ # Existing questions with new topics consolidated
103
+ example_questions = [
104
+ "Create a ten-point markdown outline with emojis about: Decreased Ξ±-ketoglutarate dehydrogenase activity in astrocytes",
105
+ "Create a ten-point markdown outline with emojis about: Lewy body dementia",
106
+ "Create a ten-point markdown outline with emojis about: Delusional disorder",
107
+ "Create a ten-point markdown outline with emojis about: Galantamine",
108
+ "Create a ten-point markdown outline with emojis about: Neural crest",
109
+ "Create a ten-point markdown outline with emojis about: Progressive multifocal encephalopathy (PML)",
110
+ "Create a ten-point markdown outline with emojis about: CT head",
111
+ "Create a ten-point markdown outline with emojis about: Ξ²-Galactocerebrosidase",
112
+ # ... add more topics in this format ...
113
+ "Create a ten-point markdown outline with emojis about: Dopamine",
114
+ "Create a ten-point markdown outline with emojis about: G protein-coupled receptors",
115
+ "Create a ten-point markdown outline with emojis about: CT scan of the head without contrast",
116
+ "Create a ten-point markdown outline with emojis about: Pyogenic brain abscess",
117
+ "Create a ten-point markdown outline with emojis about: Pneumocystitis jiroveci"
118
+ ]
119
+
120
  gr.ChatInterface(
121
  generate,
122
  additional_inputs=additional_inputs,
123
+ examples=example_questions
124
  )
125
 
126
+ demo.queue().launch(debug=True)