Spaces:
Sleeping
Sleeping
import streamlit as st | |
from backend import JSONPath_Generator | |
class JSONQuery_Frontend: | |
def __init__(self): | |
pass | |
def run(self): | |
self.titleheader() | |
self.input_text() | |
self.submit_btn() | |
def titleheader(self): | |
# Initialize Streamlit app | |
st.set_page_config(page_title="👨💻 JSON Path Generator") | |
st.header("JSON Path Generator") | |
def input_text(self): | |
# Input Text Area | |
self.open_ai_key = st.text_input(label="Enter the OpenAI Key: ") | |
self.json_value = st.text_area(label="JSON Body Input: ") | |
self.target_input = st.text_input(label="Target JSON Key: ") | |
self.json_condition = st.text_input(label="JSON Conditions (If any): ") | |
def submit_btn(self): | |
if st.button("Submit"): | |
self.json_path_gen = JSONPath_Generator(json_input=self.json_value, target_value=self.target_input, | |
json_condition=self.json_condition, | |
openai_key=self.open_ai_key) | |
res = self.json_path_gen.create_llm_chain() | |
st.write(res) | |