Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -16,9 +16,10 @@ import spaces
|
|
16 |
# Friendli AI Endpoints parameter
|
17 |
friendli_token = os.getenv("FRIENDLI_TOKEN", "your_friendli_token")
|
18 |
|
|
|
19 |
# OpenAI client for Friendli
|
20 |
client = OpenAI(
|
21 |
-
base_url="https://api.friendli.ai/
|
22 |
api_key=friendli_token
|
23 |
)
|
24 |
|
@@ -229,13 +230,12 @@ def run(message: dict, history: list[dict]) -> Iterator[str]:
|
|
229 |
|
230 |
# Generate with Friendli API
|
231 |
completion = client.chat.completions.create(
|
232 |
-
model="
|
233 |
messages=messages,
|
234 |
max_tokens=2048,
|
235 |
temperature=0.2,
|
236 |
top_p=0.9,
|
237 |
stream=True,
|
238 |
-
stop=["\nUser:", "<|endoftext|>", "</s>"]
|
239 |
)
|
240 |
|
241 |
# Stream the response
|
@@ -254,7 +254,7 @@ demo = gr.ChatInterface(
|
|
254 |
textbox=gr.MultimodalTextbox(file_types=["image", ".mp4"], file_count="multiple", autofocus=True),
|
255 |
multimodal=True,
|
256 |
stop_btn=False,
|
257 |
-
title="ChatFinanz
|
258 |
examples=[
|
259 |
[{"text": "What would be the impact of 31% US tariffs (excluding pharma) on Switzerland exports?", "files": []}],
|
260 |
[{"text": "Replicate QQQ excluding exposure to the stock with the highest PE ratio", "files": []}],
|
|
|
16 |
# Friendli AI Endpoints parameter
|
17 |
friendli_token = os.getenv("FRIENDLI_TOKEN", "your_friendli_token")
|
18 |
|
19 |
+
|
20 |
# OpenAI client for Friendli
|
21 |
client = OpenAI(
|
22 |
+
base_url="https://api.friendli.ai/dedicated/v1",
|
23 |
api_key=friendli_token
|
24 |
)
|
25 |
|
|
|
230 |
|
231 |
# Generate with Friendli API
|
232 |
completion = client.chat.completions.create(
|
233 |
+
model="jlsjb3b0fy8m", # Use appropriate model
|
234 |
messages=messages,
|
235 |
max_tokens=2048,
|
236 |
temperature=0.2,
|
237 |
top_p=0.9,
|
238 |
stream=True,
|
|
|
239 |
)
|
240 |
|
241 |
# Stream the response
|
|
|
254 |
textbox=gr.MultimodalTextbox(file_types=["image", ".mp4"], file_count="multiple", autofocus=True),
|
255 |
multimodal=True,
|
256 |
stop_btn=False,
|
257 |
+
title="ChatFinanz",
|
258 |
examples=[
|
259 |
[{"text": "What would be the impact of 31% US tariffs (excluding pharma) on Switzerland exports?", "files": []}],
|
260 |
[{"text": "Replicate QQQ excluding exposure to the stock with the highest PE ratio", "files": []}],
|