| import streamlit as st | |
| from ollama import Ollama | |
| # Initialize Ollama model | |
| ollama = Ollama(model='gpt-3') | |
| st.title("Text Generation with Ollama and Streamlit") | |
| # Input text from user | |
| prompt = st.text_area("Enter your prompt:", "") | |
| if st.button("Generate Text"): | |
| if prompt: | |
| # Generate text using Ollama | |
| response = ollama.generate(prompt) | |
| st.text_area("Generated Text:", response, height=200) | |
| else: | |
| st.warning("Please enter a prompt.") | |
| if __name__ == "__main__": | |
| main() |