Spaces:
Runtime error
Runtime error
File size: 593 Bytes
8df046a 8af9560 8df046a 8af9560 8df046a 8af9560 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import gradio as gr
from langchain import HuggingFaceHub
import os
# Set the Hugging Face API token in your environment variables
#os.environ["HUGGINGFACEHUB_API_TOKEN"] = "YOUR_TOKEN"
# Initialize the language model
llm = HuggingFaceHub(repo_id="tiiuae/falcon-7b-instruct", model_kwargs={"temperature":0.6})
def chat(user_message):
# Generate a response from the language model
response = llm(user_message)
# Return the response
return response
# Create a Gradio interface
iface = gr.Interface(fn=chat, inputs="text", outputs="text")
# Launch the interface
iface.launch() |