MarcinSmolnik commited on
Commit
ef987ac
·
verified ·
1 Parent(s): 9970cc7

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ MODEL_NAME = "speakleash/Bielik-1.5B-v3.0-Instruct"
5
+
6
+ # Tworzymy pipeline
7
+ chat = pipeline(
8
+ "text-generation",
9
+ model=MODEL_NAME,
10
+ device_map="auto" # automatycznie wybierze CPU lub GPU
11
+ )
12
+
13
+ # Funkcja do obsługi czatu
14
+ def respond(message, history):
15
+ output = chat(
16
+ message,
17
+ max_length=256,
18
+ do_sample=True,
19
+ temperature=0.7,
20
+ top_p=0.9
21
+ )
22
+ return output[0]['generated_text']
23
+
24
+ # Interfejs czatu
25
+ gr.ChatInterface(respond).launch()