# import gradio as gr # from huggingface_hub import InferenceClient # client = InferenceClient("mounseflit/falcon-7b-marrakech-v2") # def predict(message, history): # history = history or [] # history.append(message) # response = client.text_generation(text=" ".join(history), max_length=200, do_sample=True, top_k=10, num_return_sequences=1, temperature=0.1)[0]['generated_text'] # history.append(response) # response = response.replace(" ".join(history[:-1]), "") # return response, history # with gr.Blocks() as demo: # chatbot = gr.Chatbot() # message = gr.Textbox(placeholder="Enter your message here") # state = gr.State() # submit = gr.Button("SEND") # submit.click(predict, inputs=[message, state], outputs=[chatbot, state]) # demo.launch()