Spaces:
Runtime error
Runtime error
| #!/usr/bin/python | |
| 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")) | |