File size: 448 Bytes
0aa159f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
import requests

def chat_with_llama(prompt):
    response = requests.post("http://localhost:8000/completion", json={"prompt": prompt, "max_tokens": 100})
    return response.json().get("text", "Không có phản hồi từ server.")

iface = gr.Interface(
    fn=chat_with_llama,
    inputs="text",
    outputs="text",
    title="LLaMA Chatbot trên Hugging Face Space"
)

iface.launch(server_name="0.0.0.0", server_port=7860)