import gradio as gr from transformers import pipeline # Inicijalizuj model za generisanje teksta text_generator = pipeline("text-generation", model="gpt-2") # Možeš promeniti model ako želiš def generate_blog_post(topic): # Generiši tekst na osnovu zadatog teme response = text_generator(topic, max_length=300, num_return_sequences=1) return response[0]['generated_text'] # Gradio interfejs demo = gr.Interface( fn=generate_blog_post, inputs=gr.inputs.Textbox(label="Enter the topic for your blog post"), outputs=gr.outputs.Textbox(label="Generated Blog Post"), title="Blog Post Generator", description="Enter a topic and generate a blog post using AI." ) # Pokreni aplikaciju if __name__ == "__main__": demo.launch()