Mahmoud Amiri
commited on
Commit
·
a256d3e
1
Parent(s):
dc732ec
change chat completion to text to text
Browse files
app.py
CHANGED
|
@@ -13,29 +13,25 @@ def respond(
|
|
| 13 |
hf_token: gr.OAuthToken,
|
| 14 |
):
|
| 15 |
"""
|
| 16 |
-
Sends a
|
| 17 |
"""
|
| 18 |
client = InferenceClient(
|
| 19 |
token=hf_token.token,
|
| 20 |
model="Bocklitz-Lab/lit2vec-tldr-bart-model"
|
| 21 |
)
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
| 26 |
-
response =
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
messages,
|
| 30 |
-
max_tokens=max_tokens,
|
| 31 |
-
stream=True,
|
| 32 |
temperature=temperature,
|
| 33 |
-
top_p=top_p
|
| 34 |
-
)
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
yield response
|
| 39 |
|
| 40 |
# Define the Gradio interface
|
| 41 |
chatbot = gr.ChatInterface(
|
|
|
|
| 13 |
hf_token: gr.OAuthToken,
|
| 14 |
):
|
| 15 |
"""
|
| 16 |
+
Sends a user input to the summarization model using text-to-text interface.
|
| 17 |
"""
|
| 18 |
client = InferenceClient(
|
| 19 |
token=hf_token.token,
|
| 20 |
model="Bocklitz-Lab/lit2vec-tldr-bart-model"
|
| 21 |
)
|
| 22 |
|
| 23 |
+
# You can prepend the system message if needed
|
| 24 |
+
input_text = f"{system_message}\n\n{message}"
|
| 25 |
|
| 26 |
+
response = client.text_to_text(
|
| 27 |
+
input=input_text,
|
| 28 |
+
max_new_tokens=max_tokens,
|
|
|
|
|
|
|
|
|
|
| 29 |
temperature=temperature,
|
| 30 |
+
top_p=top_p
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
yield response
|
| 34 |
+
|
|
|
|
| 35 |
|
| 36 |
# Define the Gradio interface
|
| 37 |
chatbot = gr.ChatInterface(
|