File size: 552 Bytes
a36b25a
 
297030c
3897c11
a36b25a
9240a93
a36b25a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9240a93
 
 
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
import gradio as gr 
import huggingface_hub as hf_hub 
import os  

hf_client = hf_hub.InferenceClient(token = os.environ['HF_TOKEN']) 
hf_client.headers["x-use-cache"] = "0"


def interface(question):
    response = hf_client.text_generation(
        prompt = question,
        model = 'google/flan-t5-xxl',
        max_new_tokens = 1024,
        stream = False
    )

    return response

app = gr.Interface(
    fn = interface,
    inputs = gr.Textbox(label = 'Input Question'),
    outputs = gr.Textbox(label = 'Generated Response')
)

app.launch()