Spaces:
Runtime error
Runtime error
import streamlit as st | |
from gpt4all import GPT4All | |
st.title("Write a story") | |
model = GPT4All("mistral-7b-instruct-v0.1.Q4_0.gguf") | |
prompt = st.text_area("Enter a prompt:", "Write a story about a guy with a mask") | |
if st.button("Generate Text"): | |
output = model.generate(prompt) | |
sentences = output.split(".")[:-1] | |
formatted_output = ".\n".join(sentence.strip() for sentence in sentences if sentence.strip()) | |
st.write("Generated Story:") | |
st.text(formatted_output + ".") | |
st.session_state['story'] = formatted_output | |