Spaces:
Sleeping
Sleeping
File size: 1,051 Bytes
c127950 0897689 c127950 6cbb926 c127950 6cbb926 0897689 fa6182f 6cbb926 0897689 48dc1ec b25c66c 6cbb926 16d3b5a c127950 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import gradio as gr
from huggingface_hub import InferenceClient
client = InferenceClient("google/gemma-1.1-2b-it")
system_instructions = "[SYSTEM] Your task is to Answer the question. Keep conversation very short, clear and concise. The expectation is that you will avoid introductions and start answering the query directly, Only answer the question asked by user, Do not say unnecessary things.[QUESTION]"
def models(message):
messages = []
messages.append({"role": "user", "content": f"[SYSTEM] You are REAL TIME QnA AI who answer question asked by uer in short and concise [USER] {message}"})
response = ""
for message in client.chat_completion(
messages,
max_tokens=200,
stream=True
):
token = message.choices[0].delta.content
response += token
yield response
description="# Chat GO"
demo = gr.Interface(description=description,fn=models, inputs=["text"], outputs="text", live=True, batch=True, max_batch_size=10000)
demo.queue(max_size=300000)
demo.launch()
|