Spaces:
Runtime error
Runtime error
File size: 539 Bytes
42525ee |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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
|