braunale commited on
Commit
9ddca05
1 Parent(s): 2422ad2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -1,12 +1,15 @@
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, history):
8
- response = chat(prompt, max_length=50)
9
- return response[0]['generated_text']
10
 
 
 
 
 
11
  demo = gr.ChatInterface(fn=chat_with_model, title="Echo Bot")
12
  demo.launch()
 
1
  import gradio as gr
2
  from transformers import pipeline
3
+ from transformers import AutoModelForCausalLM
4
 
5
+ # chat = pipeline("text-generation", model="LeoLM/leo-mistral-hessianai-7b-chat")
6
 
7
+ model = AutoModelForCausalLM.from_pretrained("LeoLM/leo-mistral-hessianai-7b-chat", load_in_4bit=True, device_map="auto")
8
 
 
 
 
9
 
10
+ def chat_with_model(prompt, history):
11
+ #response = chat(prompt, max_length=50)
12
+ #return response[0]['generated_text']
13
+ return "works"
14
  demo = gr.ChatInterface(fn=chat_with_model, title="Echo Bot")
15
  demo.launch()