File size: 671 Bytes
8f746af
cf4adb6
d157505
8f746af
ba54308
d157505
8f746af
 
 
 
 
 
 
d157505
 
 
 
8f746af
 
d157505
 
 
 
 
8f746af
ba54308
d157505
 
aeac9e6
 
8f746af
aeac9e6
8f746af
52534e6
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import gradio as gr
import torch
from transformers import pipeline

# Initialize the inference client with the model ID
client = pipeline(model="bragour/Camel-7b-chat")

def respond(
    message,
    max_tokens,
    temperature,
    top_p,
):
    # Generate the response from the API
    result = client(
        message,
        max_new_tokens=max_tokens,
        temperature=temperature,
        top_p=top_p,
    )
    
    response = result[0]['generated_text']

    return response

# Define the Gradio interface
demo = gr.Interface(
    fn=respond,
    inputs="text",
    outputs=["text"]
)
iface.launch(inline = False)

if __name__ == "__main__":
    demo.launch()