File size: 760 Bytes
f74a1d9 13c4a3f 6bfb89e f74a1d9 13c4a3f 6bfb89e 13c4a3f f74a1d9 13c4a3f f74a1d9 13c4a3f f74a1d9 13c4a3f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import gradio as gr
from transformers import pipeline
# Inicijalizuj model za generisanje teksta
text_generator = pipeline("text-generation", model="nvidia/Llama-3.1-Nemotron-70B-Instruct-HF")
def generate_blog_post(topic):
# Generiši tekst na osnovu zadate 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()
|