Update app.py
Browse files
app.py
CHANGED
@@ -20,20 +20,19 @@ subprocess.run(
|
|
20 |
DESCRIPTION = """\
|
21 |
# Phi-3-mini-4k-instruct
|
22 |
|
23 |
-
This Space demonstrates [microsoft/Phi-3-mini-4k-instruct](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct)
|
24 |
-
|
25 |
-
For additional detail on the model, including a link to the arXiv paper, refer to the [Hugging Face Paper page for Phi 3](https://huggingface.co/papers/2404.14219) .
|
26 |
"""
|
27 |
|
28 |
token = os.environ["HF_TOKEN"]
|
29 |
|
30 |
|
31 |
model = AutoModelForCausalLM.from_pretrained(
|
32 |
-
"microsoft/Phi-3-mini-
|
33 |
token=token,
|
34 |
trust_remote_code=True,
|
35 |
)
|
36 |
-
tok = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-
|
37 |
terminators = [
|
38 |
tok.eos_token_id,
|
39 |
]
|
@@ -87,7 +86,10 @@ def chat(message, history, temperature, do_sample, max_tokens):
|
|
87 |
|
88 |
demo = gr.ChatInterface(
|
89 |
fn=chat,
|
90 |
-
examples=[
|
|
|
|
|
|
|
91 |
# multimodal=False,
|
92 |
additional_inputs_accordion=gr.Accordion(
|
93 |
label="⚙️ Parameters", open=False, render=False
|
@@ -107,7 +109,7 @@ demo = gr.ChatInterface(
|
|
107 |
),
|
108 |
],
|
109 |
stop_btn="Stop Generation",
|
110 |
-
title="Chat
|
111 |
description=DESCRIPTION,
|
112 |
)
|
113 |
demo.launch()
|
|
|
20 |
DESCRIPTION = """\
|
21 |
# Phi-3-mini-4k-instruct
|
22 |
|
23 |
+
This Space demonstrates the open source [microsoft/Phi-3-mini-4k-instruct](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct) model.
|
24 |
+
- refer to the [Hugging Face Paper page for Phi 3](https://huggingface.co/papers/2404.14219) for more info.
|
|
|
25 |
"""
|
26 |
|
27 |
token = os.environ["HF_TOKEN"]
|
28 |
|
29 |
|
30 |
model = AutoModelForCausalLM.from_pretrained(
|
31 |
+
"microsoft/Phi-3-mini-4k-instruct",
|
32 |
token=token,
|
33 |
trust_remote_code=True,
|
34 |
)
|
35 |
+
tok = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-4k-instruct", token=token)
|
36 |
terminators = [
|
37 |
tok.eos_token_id,
|
38 |
]
|
|
|
86 |
|
87 |
demo = gr.ChatInterface(
|
88 |
fn=chat,
|
89 |
+
examples=[
|
90 |
+
["Explain quantum physics in 5 words or less:"],
|
91 |
+
["Question: What do you call a bear with no teeth?\nAnswer:"],
|
92 |
+
],
|
93 |
# multimodal=False,
|
94 |
additional_inputs_accordion=gr.Accordion(
|
95 |
label="⚙️ Parameters", open=False, render=False
|
|
|
109 |
),
|
110 |
],
|
111 |
stop_btn="Stop Generation",
|
112 |
+
title="Chat with Microsoft PHI",
|
113 |
description=DESCRIPTION,
|
114 |
)
|
115 |
demo.launch()
|