lehmanc25 commited on
Commit
a5de796
1 Parent(s): 53e9d10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -1,7 +1,20 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ def chat_with_phi2(input_text):
4
+ # Encoding the input text
5
+ encoded_input = tokenizer(input_text, return_tensors='pt')
6
+ # Generating output using the fine-tuned model
7
+ output = model.generate(**encoded_input, max_length=50)
8
+ # Decoding the output tokens to a string
9
+ response = tokenizer.decode(output[0], skip_special_tokens=True)
10
+ return response
11
 
12
+ interface = gr.Interface(
13
+ fn=chat_with_phi2,
14
+ inputs=gr.inputs.Textbox(lines=2, placeholder="Ask something about W&L..."),
15
+ outputs="text",
16
+ title="W&L ChatGPT-like AI",
17
+ description="Ask any question about Washington and Lee University!"
18
+ )
19
+
20
+ interface.launch()