test-space / app.py.old
tpaduraru's picture
Rename app.py to app.py.old
78dd7be
raw
history blame contribute delete
974 Bytes
#!/usr/bin/python
#https://beebom.com/how-train-ai-chatbot-custom-knowledge-base-chatgpt-/
from llama_index import SimpleDirectoryReader, GPTListIndex, GPTVectorStoreIndex, LLMPredictor, PromptHelper
import gradio as gr
import sys
import os
import datasets
import random
def chat(message, history):
history = history or []
if message.startswith("How many"):
response = random.randint(1, 10)
elif message.startswith("How"):
response = random.choice(["Great", "Good", "Okay", "Bad"])
elif message.startswith("Where"):
response = random.choice(["Here", "There", "Somewhere"])
else:
response = "I don't know"
history.append((message, response))
return history, history
iface = gr.Interface(fn=chat,
inputs=gr.components.Textbox(lines=7, label="Enter your text"),
outputs="text",
title="JVM Lending's Chatbot")
iface.launch(auth=("JVM","LENDING"))