Update app.py
Browse files
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 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
16 |
while True:
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
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()
|