Download app.py from BeoData/README: direct link, hf CLI and curl.
- Browser
- Download file 760 Bytes
-
https://huggingface.co/spaces/BeoData/README/resolve/main/app.py
- Command line
-
hf download hf://spaces/BeoData/README/app.py
-
curl -L -o app.py https://huggingface.co/spaces/BeoData/README/resolve/main/app.py
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() | |