1javid commited on
Commit
42525ee
1 Parent(s): c459e23

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from gpt4all import GPT4All
3
+
4
+ st.title("Write a story")
5
+
6
+ model = GPT4All("mistral-7b-instruct-v0.1.Q4_0.gguf")
7
+
8
+ prompt = st.text_area("Enter a prompt:", "Write a story about a guy with a mask")
9
+
10
+ if st.button("Generate Text"):
11
+ output = model.generate(prompt)
12
+ sentences = output.split(".")[:-1]
13
+ formatted_output = ".\n".join(sentence.strip() for sentence in sentences if sentence.strip())
14
+ st.write("Generated Story:")
15
+ st.text(formatted_output + ".")
16
+ st.session_state['story'] = formatted_output