Testing3 / app.py
tommy24's picture
Update app.py
f8aef6b
raw
history blame
1.04 kB
import os
import gradio as gr
os.environ.get("var2")
def main(user):
chatbot = Chatbot(api_key=os.environ.get("test2"))
# Start chat
def get_input(var1):
# Display the prompt
print(user, end="")
# Initialize an empty list to store the input lines
lines = []
# Read lines of input until the user enters an empty line
while True:
line = ""
if line == "":
break
lines.append(line)
# Join the lines, separated by newlines, and store the result
user_input = "\n".join(lines)
# Return the input
return user_input
while True:
PROMPT = get_input("\nUser:\n")
# if PROMPT.startswith("!"):
# if chatbot_commands(PROMPT):
# continue
response = chatbot.ask(PROMPT)
response = response["choices"][0]["text"]
return response
iface = gr.Interface(fn=main, inputs="text", outputs="text")
iface.launch()