File size: 835 Bytes
f529744
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b1e7554
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
import gradio as gr
import requests
import json

API_URL = "https://jj78yliqd7.execute-api.eu-central-1.amazonaws.com/dev/chatbot"

def send_prompt_to_api(prompt, message):
    params = {"prompt": prompt}
    response = requests.get(API_URL, params=params)
    if response.status_code == 200:
        response_body = response.json().get('body')
        answer = response_body.get('answer')
        return answer
    else:
        return "Sorry, something went wrong. Please try again."

gr.ChatInterface(
    send_prompt_to_api,
    chatbot=gr.Chatbot(height=700),
    textbox=gr.Textbox(placeholder="Ask me a question", container=False, scale=7),
    title="Wissensguru - IDTA",
    theme="soft",
    examples=[
    ],
    cache_examples=False,
    retry_btn="Retry",
    undo_btn="Delete Previous",
    clear_btn="Clear",
).launch()