hectorjelly commited on
Commit
a906422
1 Parent(s): c4cb477

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -1,9 +1,5 @@
1
  import gradio as gr
2
  import openai
3
- import logging
4
-
5
- # Initialize the logger with level INFO
6
- logging.basicConfig(filename='conversation_history.log', level=logging.INFO)
7
 
8
  # Initialize the conversation history
9
  conversation_history = [
@@ -51,13 +47,13 @@ def ask_joe(api_key, text):
51
  "content": model_message
52
  })
53
 
54
- # Log the conversation history
55
- logging.info(f'User: {text}')
56
- logging.info(f'AI: {model_message}')
 
57
 
58
  return model_message
59
 
60
  iface = gr.Interface(fn=ask_joe, inputs=[gr.inputs.Textbox(label="OpenAI API Key"), gr.inputs.Textbox(label="Enter your question here. More detail = Better results")], outputs=gr.outputs.Textbox(label="Joe's Response"))
61
 
62
-
63
  iface.launch()
 
1
  import gradio as gr
2
  import openai
 
 
 
 
3
 
4
  # Initialize the conversation history
5
  conversation_history = [
 
47
  "content": model_message
48
  })
49
 
50
+ # Write the conversation history to a file
51
+ with open('conversation_history.txt', 'a') as f:
52
+ f.write(f'User: {text}\n')
53
+ f.write(f'AI: {model_message}\n')
54
 
55
  return model_message
56
 
57
  iface = gr.Interface(fn=ask_joe, inputs=[gr.inputs.Textbox(label="OpenAI API Key"), gr.inputs.Textbox(label="Enter your question here. More detail = Better results")], outputs=gr.outputs.Textbox(label="Joe's Response"))
58
 
 
59
  iface.launch()