braunale commited on
Commit
a4a7438
1 Parent(s): 12e65a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -1,7 +1,21 @@
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
+ from transformers import pipeline
3
 
4
+ chat = pipeline("text-generation", model="LeoLM/leo-mistral-hessianai-7b-chat")
 
5
 
6
+
7
+ def chat_with_model(prompt):
8
+ response = chat(prompt, max_length=50)
9
+ return response[0]['generated_text']
10
+
11
+ # Create the Gradio interface
12
+ iface = gr.Interface(
13
+ fn=chat_with_model,
14
+ inputs=gr.inputs.Textbox(lines=2, placeholder="Type your message here..."),
15
+ outputs="text",
16
+ title="Chat with LLM",
17
+ description="Type a message and chat with a language model."
18
+ )
19
+
20
+ if __name__ == "__main__":
21
+ iface.launch()