README / app.py
Dejansimic's picture
Update app.py
6bfb89e verified
raw
history blame
760 Bytes
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()