Spaces:
Runtime error
Runtime error
app.py
Browse files
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()
|