File size: 371 Bytes
05a2e79
5754dc6
c1e05b4
5754dc6
05a2e79
c1e05b4
05a2e79
5754dc6
c1e05b4
 
 
 
 
5754dc6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import os
import gradio as gr
from transformers import pipeline

token = os.environ.get('HF_TOKEN')
# Use a pipeline as a high-level helper
pipe = pipeline("text-generation", model="meta-llama/Llama-2-7b-chat-hf", token=token)

def llama_chat(name):
    resp = pipe(name)
    return resp

iface = gr.Interface(fn=llama_chat, inputs="text", outputs="text")
iface.launch()