gdnartea commited on
Commit
f0b7b32
·
verified ·
1 Parent(s): b4a0c25

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -17,8 +17,8 @@ proc_tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-4k-instruct
17
 
18
  proc_pipe = pipeline(
19
  "text-generation",
20
- model=model,
21
- tokenizer=tokenizer,
22
  )
23
 
24
  generation_args = {
@@ -28,12 +28,16 @@ generation_args = {
28
  "do_sample": False,
29
  }
30
 
 
 
 
 
31
 
32
 
33
  # Create a Gradio interface
34
  iface = gr.Interface(
35
- fn=proc_pipe,
36
- inputs=[gr.Textbox(lines=5, placeholder="Enter your prompt here..."), **generation_args]
37
  outputs=gr.Textbox()
38
  )
39
 
 
17
 
18
  proc_pipe = pipeline(
19
  "text-generation",
20
+ model=proc_model,
21
+ tokenizer=proc_tokenizer,
22
  )
23
 
24
  generation_args = {
 
28
  "do_sample": False,
29
  }
30
 
31
+ def generate_response(inputs):
32
+ output = proc_pipe(inputs, **generation_args)
33
+ return output[0]['generated_text']
34
+
35
 
36
 
37
  # Create a Gradio interface
38
  iface = gr.Interface(
39
+ fn=generate_response,
40
+ inputs=[gr.Textbox(lines=5, placeholder="Enter your prompt here...")]
41
  outputs=gr.Textbox()
42
  )
43