NeuralJunkie commited on
Commit
ebd70cc
·
1 Parent(s): 83ab064

Create app.py

Browse files

Initial committ

Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import chatGPT
3
+ import wolframalpha
4
+
5
+ # Create a ChatGPT instance
6
+ chatGPT_model = chatGPT.ChatGPT()
7
+
8
+ # Create a Wolfram Alpha API instance
9
+ wolframalpha_client = wolframalpha.Client()
10
+
11
+ # Define the gradio app
12
+ @gr.app(title="ChatGPT with Wolfram Alpha", description="A chat app that uses ChatGPT and Wolfram Alpha")
13
+ def chat_with_wolframalpha(text):
14
+ # Get the response from ChatGPT
15
+ gpt_response = chatGPT_model.generate_response(text)
16
+
17
+ # Ask Wolfram Alpha for the answer to the question
18
+ wolfram_response = wolframalpha_client.query(gpt_response)
19
+
20
+ # Return the combined response
21
+ return gpt_response, wolfram_response
22
+
23
+ # Run the gradio app
24
+ gr.server(chat_with_wolframalpha, port=8000)