import json import os import base64 import streamlit as st from jina import Client, Document, DocumentArray st.set_page_config( page_title="", page_icon="", layout="", initial_sidebar_state="", ) st.title("
") st.markdown( "<10 word description here>" "To deploy your own microservice, click [here](https://github.com/jina-ai/dev-gpt)." ) st.header(" Input Parameters") # only if input parameters are needed with st.form(key="input_form"): input_data = { } input_json = json.dumps(input_data) # Process input and call microservice if submit_button: with st.spinner("Generating collage..."): client = Client(host="http://localhost:8080") d = Document(text=input_json) response = client.post("/", inputs=DocumentArray([d])) output_data = json.loads(response[0].text) # Display curl command deployment_id = os.environ.get("K8S_NAMESPACE_NAME", "") host = ( f"https://dev-gpt-{deployment_id.split('-')[1]}.wolf.jina.ai/post" if deployment_id else "http://localhost:8080/post" ) with st.expander("See curl command"): st.markdown("You can use the following curl command to send a request to the microservice from the command line:") st.code( f'curl -X "POST" "{host}" -H "accept: application/json" -H "Content-Type: application/json" -d \'{{"data": [{{"text": "{input_json}"}}]}}\'', language="bash", )