Spaces:
Runtime error
Runtime error
File size: 1,632 Bytes
fb49ad8 4376882 fb49ad8 4376882 fb49ad8 a49ee2f 64374d2 fb49ad8 5280802 1d9e19f 5280802 a49ee2f 5280802 1d9e19f 5280802 fb49ad8 9267364 a49ee2f b24a219 d4b5669 9267364 fb49ad8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
import gradio as gr
from gradio_client import Client
access_token = "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"
# Function to call the Gradio API
def call_gradio_api(user_input):
client = Client("https://traversaal-internal-rag-faiss-gpt3-5.hf.space/", hf_token=access_token)
result = client.predict(user_input, api_name="/predict")
return result[0], result[1], result[2], result[3]
# Interface for the Gradio app
new_prompt = gr.Textbox(
label="Augmented Prompt", placeholder="Augmented Prompt will appear here"
)
chat_response_1 = gr.Textbox(
label="Response based on augmented prompt", placeholder="Response of the prompt will appear here"
)
chat_response_2 = gr.Textbox(
label="Response based on original prompt", placeholder="Response of the prompt will appear here"
)
source_list = gr.Textbox(
label="Sources", placeholder="Document source title and doi will appear here"
)
iface = gr.Interface(
fn=call_gradio_api,
inputs="text",
outputs = [new_prompt, chat_response_1, chat_response_2, source_list],
examples=["Make me a 4-hour workshop agenda for handling conflict", "Tell me about the different skills from middle management to executive leadership", "What are some of the major debates among scholars regarding the trait versus process theories of leadership? How have these perspectives evolved over time?"],
layout="horizontal",
title="CCL Playground",
description="Enter a query to get response using RAG"
)
# Launch the Gradio app
iface.launch()
|