anakin87 commited on
Commit
1219a4a
โ€ข
1 Parent(s): 4d3de5e

improvements

Browse files
Files changed (2) hide show
  1. app.py +12 -8
  2. style.css +11 -0
app.py CHANGED
@@ -16,13 +16,12 @@ subprocess.run(
16
 
17
 
18
  DESCRIPTION = """\
19
- # Gemma 2 9B IT
20
 
21
- Gemma 2 is Google's latest iteration of open LLMs.
22
- This is a demo of [`google/gemma-2-9b-it`](https://huggingface.co/google/gemma-2-9b-it), fine-tuned for instruction following.
23
- For more details, please check [our post](https://huggingface.co/blog/gemma2).
24
 
25
- ๐Ÿ‘‰ Looking for a larger and more powerful version? Try the 27B version in [HuggingChat](https://huggingface.co/chat/models/google/gemma-2-27b-it).
26
  """
27
 
28
  MAX_MAX_NEW_TOKENS = 2048
@@ -47,13 +46,14 @@ model.eval()
47
  def generate(
48
  message: str,
49
  chat_history: list[tuple[str, str]],
 
50
  max_new_tokens: int = 1024,
51
  temperature: float = 0.001,
52
  top_p: float = 1.0,
53
  top_k: int = 50,
54
  repetition_penalty: float = 1.0,
55
  ) -> Iterator[str]:
56
- conversation = []
57
  for user, assistant in chat_history:
58
  conversation.extend(
59
  [
@@ -93,6 +93,11 @@ def generate(
93
  chat_interface = gr.ChatInterface(
94
  fn=generate,
95
  additional_inputs=[
 
 
 
 
 
96
  gr.Slider(
97
  label="Max new tokens",
98
  minimum=1,
@@ -138,7 +143,6 @@ chat_interface = gr.ChatInterface(
138
  ["Fammi un elenco puntato dei pro e contro di vivere in Italia. Massimo 2 pro e 2 contro."],
139
  ["Inventa una breve storia con animali sul valore dell'amicizia."],
140
  ["Scrivi un articolo di 100 parole sui 'Benefici dell'open-source nella ricerca sull'intelligenza artificiale'"],
141
- ["Hello there! How are you doing?"],
142
  ["Can you explain briefly to me what is the Python programming language?"],
143
  ["How many hours does it take a man to eat a Helicopter?"],
144
  ["Write a 100-word article on 'Benefits of Open-Source in AI research'"],
@@ -146,7 +150,7 @@ chat_interface = gr.ChatInterface(
146
  cache_examples=False,
147
  )
148
 
149
- with gr.Blocks(css="style.css", fill_height=True) as demo:
150
  gr.Markdown(DESCRIPTION)
151
  gr.DuplicateButton(value="Duplicate Space for private use", elem_id="duplicate-button")
152
  chat_interface.render()
 
16
 
17
 
18
  DESCRIPTION = """\
19
+ # Phi 3.5 mini ITA ๐Ÿ’ฌ ๐Ÿ‡ฎ๐Ÿ‡น
20
 
21
+ Fine-tuned version of Microsoft/Phi-3.5-mini-instruct to improve the performance on the Italian language.
22
+ Small (3.82 B parameters) but capable model, with 128k context length.
 
23
 
24
+ For more details, check out the [model card](https://huggingface.co/anakin87/Phi-3.5-mini-ITA).
25
  """
26
 
27
  MAX_MAX_NEW_TOKENS = 2048
 
46
  def generate(
47
  message: str,
48
  chat_history: list[tuple[str, str]],
49
+ system_message: str = "",
50
  max_new_tokens: int = 1024,
51
  temperature: float = 0.001,
52
  top_p: float = 1.0,
53
  top_k: int = 50,
54
  repetition_penalty: float = 1.0,
55
  ) -> Iterator[str]:
56
+ conversation = [{"role": "system", "content": system_message}]
57
  for user, assistant in chat_history:
58
  conversation.extend(
59
  [
 
93
  chat_interface = gr.ChatInterface(
94
  fn=generate,
95
  additional_inputs=[
96
+ gr.Textbox(
97
+ value="",
98
+ label="System message",
99
+ render=False,
100
+ ),
101
  gr.Slider(
102
  label="Max new tokens",
103
  minimum=1,
 
143
  ["Fammi un elenco puntato dei pro e contro di vivere in Italia. Massimo 2 pro e 2 contro."],
144
  ["Inventa una breve storia con animali sul valore dell'amicizia."],
145
  ["Scrivi un articolo di 100 parole sui 'Benefici dell'open-source nella ricerca sull'intelligenza artificiale'"],
 
146
  ["Can you explain briefly to me what is the Python programming language?"],
147
  ["How many hours does it take a man to eat a Helicopter?"],
148
  ["Write a 100-word article on 'Benefits of Open-Source in AI research'"],
 
150
  cache_examples=False,
151
  )
152
 
153
+ with gr.Blocks(css="style.css", fill_height=True, theme="soft") as demo:
154
  gr.Markdown(DESCRIPTION)
155
  gr.DuplicateButton(value="Duplicate Space for private use", elem_id="duplicate-button")
156
  chat_interface.render()
style.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ h1 {
2
+ text-align: center;
3
+ display: block;
4
+ }
5
+
6
+ #duplicate-button {
7
+ margin: auto;
8
+ color: #fff;
9
+ background: #1565c0;
10
+ border-radius: 100vh;
11
+ }