Spaces:
Sleeping
Sleeping
import gradio as gr | |
import os | |
from langchain_huggingface import HuggingFaceEndpoint | |
api_key = os.getenv("HUGGINGFACE_API_KEY") | |
llm = HuggingFaceEndpoint( | |
repo_id="meta-llama/Meta-Llama-3-8B-Instruct", | |
task="text-generation", | |
max_new_tokens=512, | |
do_sample=False, | |
api_key=api_key | |
) | |
def answer(question): | |
out = llm.invoke(question) | |
return out | |
demo = gr.Interface(fn=answer, inputs='text', outputs='text', examples=[['What is the Generative AI?']]) | |
demo.launch() | |