serenitysphere commited on
Commit
c6259e2
1 Parent(s): eb8a576
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
+ # Wczytywanie modelu Bielik-7B
5
+ model = pipeline("text-generation", model="speakleash/Bielik-7B-v0.1")
6
+
7
+ def generate_description(product_name, product_features):
8
+ prompt = (
9
+ f"Opisz produkt o nazwie {product_name}, który posiada następujące cechy: {product_features}. "
10
+ "Podaj jego główne zalety, zastosowania i cechy wyróżniające. Wyjaśnij, dlaczego warto go kupić."
11
+ )
12
+ result = model(prompt, max_length=200, temperature=0.7, top_p=0.9)
13
+ return result[0]['generated_text']
14
+
15
+ # Konfiguracja interfejsu Gradio
16
+ iface = gr.Interface(
17
+ fn=generate_description,
18
+ inputs=["text", "text"],
19
+ outputs="text",
20
+ title="Bielik-7B Product Description Generator",
21
+ description="Wprowadź nazwę produktu i jego cechy, aby wygenerować opis."
22
+ )
23
+
24
+ if __name__ == "__main__":
25
+ iface.launch()