Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -12,24 +12,14 @@ DEFAULT_MAX_NEW_TOKENS = 1024
|
|
12 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
13 |
|
14 |
DESCRIPTION = """\
|
15 |
-
#
|
16 |
|
17 |
-
This Space demonstrates model [
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
🔨 Looking for an even more powerful model? Check out the large [**70B** model demo](https://huggingface.co/spaces/ysharma/Explore_llamav2_with_TGI).
|
22 |
-
🐇 For a smaller model that you can run on many GPUs, check our [7B model demo](https://huggingface.co/spaces/huggingface-projects/llama-2-7b-chat).
|
23 |
|
24 |
"""
|
25 |
|
26 |
-
LICENSE = """
|
27 |
-
<p/>
|
28 |
-
|
29 |
-
---
|
30 |
-
As a derivate work of [Llama-2-13b-chat](https://huggingface.co/meta-llama/Llama-2-13b-chat) by Meta,
|
31 |
-
this demo is governed by the original [license](https://huggingface.co/spaces/huggingface-projects/llama-2-13b-chat/blob/main/LICENSE.txt) and [acceptable use policy](https://huggingface.co/spaces/huggingface-projects/llama-2-13b-chat/blob/main/USE_POLICY.md).
|
32 |
-
"""
|
33 |
|
34 |
if not torch.cuda.is_available():
|
35 |
DESCRIPTION += "\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>"
|
@@ -45,7 +35,7 @@ if torch.cuda.is_available():
|
|
45 |
def generate(
|
46 |
message: str,
|
47 |
chat_history: list[dict],
|
48 |
-
system_prompt: str = "",
|
49 |
max_new_tokens: int = 1024,
|
50 |
temperature: float = 0.6,
|
51 |
top_p: float = 0.95,
|
@@ -130,11 +120,8 @@ chat_interface = gr.ChatInterface(
|
|
130 |
],
|
131 |
stop_btn=None,
|
132 |
examples=[
|
133 |
-
["
|
134 |
-
["
|
135 |
-
["Explain the plot of Cinderella in a sentence."],
|
136 |
-
["How many hours does it take a man to eat a Helicopter?"],
|
137 |
-
["Write a 100-word article on 'Benefits of Open-Source in AI research'"],
|
138 |
],
|
139 |
cache_examples=False,
|
140 |
type="messages",
|
@@ -143,7 +130,6 @@ chat_interface = gr.ChatInterface(
|
|
143 |
with gr.Blocks(css_paths="style.css", fill_height=True) as demo:
|
144 |
gr.Markdown(DESCRIPTION)
|
145 |
chat_interface.render()
|
146 |
-
gr.Markdown(LICENSE)
|
147 |
|
148 |
if __name__ == "__main__":
|
149 |
demo.queue(max_size=20).launch()
|
|
|
12 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
13 |
|
14 |
DESCRIPTION = """\
|
15 |
+
# ALLaM-7B Instruct
|
16 |
|
17 |
+
This Space demonstrates model [ALLaM-7B-Instruct-preview](https://huggingface.co/ALLaM-AI/ALLaM-7B-Instruct-preview) by National Center for Artificial Intelligence (NCAI) at the Saudi Data and AI Authority (SDAIA)!
|
18 |
|
19 |
+
ALLaM works with both the Arabic and English languages.
|
|
|
|
|
|
|
20 |
|
21 |
"""
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
if not torch.cuda.is_available():
|
25 |
DESCRIPTION += "\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>"
|
|
|
35 |
def generate(
|
36 |
message: str,
|
37 |
chat_history: list[dict],
|
38 |
+
system_prompt: str = "أنت علام، مساعد ذكاء اصطناعي مطور من الهيئة السعودية للبيانات والذكاء الاصطناعي، تجيب على الأسئلة بطريقة مفيدة مع مراعاة القيم الثقافية المحلية.",
|
39 |
max_new_tokens: int = 1024,
|
40 |
temperature: float = 0.6,
|
41 |
top_p: float = 0.95,
|
|
|
120 |
],
|
121 |
stop_btn=None,
|
122 |
examples=[
|
123 |
+
["كيف أجهز كوب شاهي؟"],
|
124 |
+
["ازيك يسطا عامل ايه؟"],
|
|
|
|
|
|
|
125 |
],
|
126 |
cache_examples=False,
|
127 |
type="messages",
|
|
|
130 |
with gr.Blocks(css_paths="style.css", fill_height=True) as demo:
|
131 |
gr.Markdown(DESCRIPTION)
|
132 |
chat_interface.render()
|
|
|
133 |
|
134 |
if __name__ == "__main__":
|
135 |
demo.queue(max_size=20).launch()
|