tommy24 commited on
Commit
0755e92
·
1 Parent(s): f8aef6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -29
app.py CHANGED
@@ -1,37 +1,27 @@
1
  import os
2
  import gradio as gr
3
- os.environ.get("var2")
4
 
5
  def main(user):
6
- chatbot = Chatbot(api_key=os.environ.get("test2"))
7
- # Start chat
8
- def get_input(var1):
9
- # Display the prompt
10
- print(user, end="")
11
-
12
- # Initialize an empty list to store the input lines
13
- lines = []
14
-
15
- # Read lines of input until the user enters an empty line
 
 
 
 
16
  while True:
17
- line = ""
18
- if line == "":
19
- break
20
- lines.append(line)
21
-
22
- # Join the lines, separated by newlines, and store the result
23
- user_input = "\n".join(lines)
24
-
25
- # Return the input
26
- return user_input
27
- while True:
28
- PROMPT = get_input("\nUser:\n")
29
- # if PROMPT.startswith("!"):
30
- # if chatbot_commands(PROMPT):
31
- # continue
32
- response = chatbot.ask(PROMPT)
33
- response = response["choices"][0]["text"]
34
- return response
35
 
36
  iface = gr.Interface(fn=main, inputs="text", outputs="text")
37
  iface.launch()
 
1
  import os
2
  import gradio as gr
3
+ from os.environ.get("var2") import ChatBot
4
 
5
  def main(user):
6
+ if "/web" in user:
7
+ return True
8
+ else:
9
+ chatbot = Chatbot(api_key=os.environ.get("test2"))
10
+ def get_input(var1):
11
+ print(user, end="")
12
+ lines = []
13
+ while True:
14
+ line = ""
15
+ if line == "":
16
+ break
17
+ lines.append(line)
18
+ user_input = "\n".join(lines)
19
+ return user_input
20
  while True:
21
+ PROMPT = get_input("\nUser:\n")
22
+ response = chatbot.ask(PROMPT)
23
+ response = response["choices"][0]["text"]
24
+ return response
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  iface = gr.Interface(fn=main, inputs="text", outputs="text")
27
  iface.launch()