Commit ·
acecce5
1
Parent(s): a499204
Upgrade to Gradio 5.29 for Python 3.13 compatibility
Browse files- README.md +1 -2
- app.py +2 -6
- requirements.txt +2 -1
README.md
CHANGED
|
@@ -4,8 +4,7 @@ emoji: 🚀
|
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: yellow
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
python_version: '3.11'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
| 11 |
license: mit
|
|
|
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: yellow
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.29.0
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
app.py
CHANGED
|
@@ -14,12 +14,7 @@ client = OpenAI(base_url=VLLM_BASE_URL, api_key="not-required")
|
|
| 14 |
def chat(message, history):
|
| 15 |
messages = [{"role": "system", "content": "You are a helpful assistant."}]
|
| 16 |
for item in history:
|
| 17 |
-
|
| 18 |
-
messages.append({"role": item["role"], "content": item["content"]})
|
| 19 |
-
else:
|
| 20 |
-
messages.append({"role": "user", "content": item[0]})
|
| 21 |
-
if item[1]:
|
| 22 |
-
messages.append({"role": "assistant", "content": item[1]})
|
| 23 |
messages.append({"role": "user", "content": message})
|
| 24 |
|
| 25 |
stream = client.chat.completions.create(
|
|
@@ -38,6 +33,7 @@ def chat(message, history):
|
|
| 38 |
|
| 39 |
demo = gr.ChatInterface(
|
| 40 |
fn=chat,
|
|
|
|
| 41 |
title="AMD MI300X AI Demo",
|
| 42 |
description="Chat with an LLM running on AMD MI300X GPU via vLLM.",
|
| 43 |
examples=["Explain what AMD MI300X is.", "Write a Python hello world."],
|
|
|
|
| 14 |
def chat(message, history):
|
| 15 |
messages = [{"role": "system", "content": "You are a helpful assistant."}]
|
| 16 |
for item in history:
|
| 17 |
+
messages.append({"role": item["role"], "content": item["content"]})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
messages.append({"role": "user", "content": message})
|
| 19 |
|
| 20 |
stream = client.chat.completions.create(
|
|
|
|
| 33 |
|
| 34 |
demo = gr.ChatInterface(
|
| 35 |
fn=chat,
|
| 36 |
+
type="messages",
|
| 37 |
title="AMD MI300X AI Demo",
|
| 38 |
description="Chat with an LLM running on AMD MI300X GPU via vLLM.",
|
| 39 |
examples=["Explain what AMD MI300X is.", "Write a Python hello world."],
|
requirements.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
|
|
|
|
|
|
| 1 |
+
gradio==5.29.0
|
| 2 |
+
openai>=1.0.0
|