File size: 694 Bytes
d50f3dc 03a458a d50f3dc 0861f4f d50f3dc 0861f4f 03a458a d50f3dc 86b36aa d50f3dc 0861f4f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import gradio as gr, os, huggingface_hub as hf
def go(m, q):
c = hf.InferenceClient(api_key=os.environ["HF_TOKEN"])
s = c.chat.completions.create(model=m, messages=[{"role":"user","content":q}], stream=True)
for i in s:
if i.choices and i.choices[0].delta.content:
yield i.choices[0].delta.content
models = [
"deepseek-ai/DeepSeek-V3.1",
"meta-llama/Meta-Llama-3-8B-Instruct",
"Qwen/Qwen2.5-7B-Instruct",
"2F-AI/Titan-Atom",
"NobodyExistsOnTheInternet/K3-Q4-GGUF"
]
gr.Interface(
fn=go,
inputs=[gr.Dropdown(models), gr.Textbox(label="Ask")],
outputs=gr.Textbox(label="Reply"),
title="Multi-Model Chat"
).launch(share=True)
|