Rijgersberg
commited on
Commit
•
bdbcb4a
1
Parent(s):
9126b45
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,6 @@ from threading import Thread
|
|
5 |
from typing import Iterator
|
6 |
|
7 |
import gradio as gr
|
8 |
-
import spaces
|
9 |
import torch
|
10 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
11 |
|
@@ -13,13 +12,11 @@ MAX_MAX_NEW_TOKENS = 2048
|
|
13 |
DEFAULT_MAX_NEW_TOKENS = 1024
|
14 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "8192"))
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
20 |
|
21 |
|
22 |
-
@spaces.GPU(duration=45)
|
23 |
def generate(
|
24 |
message: str,
|
25 |
chat_history: list[tuple[str, str]],
|
@@ -64,7 +61,7 @@ def generate(
|
|
64 |
chat_interface = gr.ChatInterface(
|
65 |
fn=generate,
|
66 |
chatbot=gr.Chatbot(height=450,
|
67 |
-
label="
|
68 |
show_share_button=True,
|
69 |
# avatar_images=(None, 'geitje-logo.jpg')
|
70 |
),
|
@@ -135,8 +132,8 @@ Twee van de wortelbedrijven werkten mee door meer informatie over de ongeoorloof
|
|
135 |
```
|
136 |
Vat bovenstaand artikel samen"""]
|
137 |
],
|
138 |
-
title="
|
139 |
-
description="""
|
140 |
submit_btn="Genereer",
|
141 |
stop_btn="Stop",
|
142 |
retry_btn="🔄 Opnieuw",
|
|
|
5 |
from typing import Iterator
|
6 |
|
7 |
import gradio as gr
|
|
|
8 |
import torch
|
9 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
10 |
|
|
|
12 |
DEFAULT_MAX_NEW_TOKENS = 1024
|
13 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "8192"))
|
14 |
|
15 |
+
model_id = "utter-project/EuroLLM-1.7B-Instruct"
|
16 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
17 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
|
|
18 |
|
19 |
|
|
|
20 |
def generate(
|
21 |
message: str,
|
22 |
chat_history: list[tuple[str, str]],
|
|
|
61 |
chat_interface = gr.ChatInterface(
|
62 |
fn=generate,
|
63 |
chatbot=gr.Chatbot(height=450,
|
64 |
+
label="utter-project/EuroLLM-1.7B-Instruct",
|
65 |
show_share_button=True,
|
66 |
# avatar_images=(None, 'geitje-logo.jpg')
|
67 |
),
|
|
|
132 |
```
|
133 |
Vat bovenstaand artikel samen"""]
|
134 |
],
|
135 |
+
title="utter-project/EuroLLM-1.7B-Instruct",
|
136 |
+
description="""utter-project/EuroLLM-1.7B-Instruct quick demo""",
|
137 |
submit_btn="Genereer",
|
138 |
stop_btn="Stop",
|
139 |
retry_btn="🔄 Opnieuw",
|