vkthakur88 commited on
Commit
a36b25a
1 Parent(s): b00c2dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -2
app.py CHANGED
@@ -1,3 +1,22 @@
1
- import gradio as gr
 
 
2
 
3
- gr.load("models/google/flan-t5-xxl").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import huggingface_hub as hf_hub
3
+ import os
4
 
5
+ hf_client = hf_hub.InferenceClient(token = os.environ['HF_TOKEN'])
6
+
7
+
8
+ def interface(question):
9
+ response = hf_client.text_generation(
10
+ prompt = question,
11
+ model = 'google/flan-t5-xxl',
12
+ max_new_tokens = 1024,
13
+ stream = False
14
+ )
15
+
16
+ return response
17
+
18
+ app = gr.Interface(
19
+ fn = interface,
20
+ inputs = gr.Textbox(label = 'Input Question'),
21
+ outputs = gr.Textbox(label = 'Generated Response')
22
+ )