Spaces:
Runtime error
Runtime error
Commit
·
e45d816
1
Parent(s):
b23917e
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ def save_to_file(responses, output_file):
|
|
19 |
|
20 |
def call_openai_api(chunk):
|
21 |
response = openai.ChatCompletion.create(
|
22 |
-
model="gpt-
|
23 |
messages=[
|
24 |
{"role": "system", "content": "PASS IN ANY ARBITRARY SYSTEM VALUE TO GIVE THE AI AN IDENITY"},
|
25 |
{"role": "user", "content": f"OPTIONAL PREPROMPTING FOLLOWING BY YOUR DATA TO PASS IN: {chunk}."},
|
@@ -47,16 +47,32 @@ def process_chunks(input_text):
|
|
47 |
|
48 |
def main():
|
49 |
st.title("InfiniteGPT")
|
50 |
-
st.write("Input unlimited size text and process it using the OpenAI API.")
|
51 |
st.write("For more details and credit check this [GitHub repository](https://github.com/emmethalm/infiniteGPT).")
|
|
|
|
|
|
|
52 |
|
53 |
-
|
54 |
-
|
|
|
|
|
55 |
|
|
|
|
|
|
|
|
|
56 |
if process_button and input_text:
|
57 |
with st.spinner("Processing text..."):
|
58 |
output_text = process_chunks(input_text)
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
if __name__ == "__main__":
|
62 |
main()
|
|
|
19 |
|
20 |
def call_openai_api(chunk):
|
21 |
response = openai.ChatCompletion.create(
|
22 |
+
model="gpt-4",
|
23 |
messages=[
|
24 |
{"role": "system", "content": "PASS IN ANY ARBITRARY SYSTEM VALUE TO GIVE THE AI AN IDENITY"},
|
25 |
{"role": "user", "content": f"OPTIONAL PREPROMPTING FOLLOWING BY YOUR DATA TO PASS IN: {chunk}."},
|
|
|
47 |
|
48 |
def main():
|
49 |
st.title("InfiniteGPT")
|
50 |
+
st.write("Input unlimited size text and process it using the GPT-4 OpenAI API.")
|
51 |
st.write("For more details and credit check this [GitHub repository](https://github.com/emmethalm/infiniteGPT).")
|
52 |
+
|
53 |
+
# Define columns for input and output
|
54 |
+
col1, col2 = st.columns(2)
|
55 |
|
56 |
+
with col1:
|
57 |
+
input_text = st.text_area("Enter or paste your text here", height=300)
|
58 |
+
process_button = st.button("Process Text")
|
59 |
+
|
60 |
|
61 |
+
# Initialize output_text as an empty string
|
62 |
+
output_text = ''
|
63 |
+
|
64 |
+
# Process text if the button is pressed
|
65 |
if process_button and input_text:
|
66 |
with st.spinner("Processing text..."):
|
67 |
output_text = process_chunks(input_text)
|
68 |
+
|
69 |
+
with col2:
|
70 |
+
st.text_area("Output", output_text, height=300)
|
71 |
+
clear_button = st.button("Clear Text")
|
72 |
+
|
73 |
+
if clear_button:
|
74 |
+
input_text = ''
|
75 |
+
st.experimental_rerun()
|
76 |
|
77 |
if __name__ == "__main__":
|
78 |
main()
|