ccl-playground / app.py
darshil3011's picture
Update app.py
5280802
raw
history blame
1.09 kB
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]
# Interface for the Gradio app
new_prompt = gr.Textbox(
label="Augmented Prompt", placeholder="The generated summary will appear here"
)
chat_response = gr.Textbox(
label="Response", placeholder="The generated summary will appear here"
)
source_list = gr.Textbox(
label="Sources", placeholder="The generated summary will appear here"
)
iface = gr.Interface(
fn=call_gradio_api,
inputs="text",
outputs = [new_prompt, chat_response, source_list],
layout="vertical",
title="CCL Playground",
description="Enter a query to get response using RAG"
)
# Launch the Gradio app
iface.launch()